You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Richard Sand <rs...@vgalleries.com> on 2001/12/22 20:33:59 UTC
xtags question with when tag
Hi all,
I have a simple xtags file that loops through all of the topics and keywords
in an xml help file.
My loop is:
<xtags:forEach select="/help/topic | /help/keyword">
Within this loop, I want to process topics different than keywords. I
haven't been able to find a way to do this. I tried to do it by testing for
the existence of a child that only exists for a keyword, but the xtag:when
tag doesn't seem to accept wildcards in its test parameter, i.e.:
<xtags:forEach select="/help/topic | /help/keyword">
<xtags:choose>
<xtags:when test="keyword_file=*">
....
</xtags:when>
<xtags:otherwise>
.....
</xtags:otherwise>
</xtags:choose>
</xtags:forEach>
Is there some way to do this?
Thanks!
-Richard
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: xtags question with when tag
Posted by James Strachan <ja...@yahoo.co.uk>.
Hi Richard
----- Original Message -----
From: "Richard Sand" <rs...@vgalleries.com>
> Hi all,
>
> I have a simple xtags file that loops through all of the topics and
keywords
> in an xml help file.
>
> My loop is:
>
> <xtags:forEach select="/help/topic | /help/keyword">
>
> Within this loop, I want to process topics different than keywords. I
> haven't been able to find a way to do this. I tried to do it by testing
for
> the existence of a child that only exists for a keyword, but the xtag:when
> tag doesn't seem to accept wildcards in its test parameter, i.e.:
>
> <xtags:forEach select="/help/topic | /help/keyword">
> <xtags:choose>
> <xtags:when test="keyword_file=*">
> ....
> </xtags:when>
> <xtags:otherwise>
> .....
> </xtags:otherwise>
> </xtags:choose>
> </xtags:forEach>
You could try this...
<xtags:when test="keyword_file">
which will match if the current node (a <keyword> or <topic>) has at least
one child <keyword_file> child.
> Is there some way to do this?
Maybe something like this, iterate through all children of <help> then
branch based on the name
<xtags:forEach select="/help/*">
<xtags:choose>
<xtags:when test="name()='topic'">
....
process a <topic>
...
</xtags:when>
<xtags:when test="name()='keyword'">
....
process a <keyword>
...
</xtags:when>
<xtags:otherwise>
.....
</xtags:otherwise>
</xtags:choose>
</xtags:forEach>
James
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>