tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james_strac...@yahoo.co.uk>
Subject Re: xtags question with when tag
Date Thu, 27 Dec 2001 13:36:28 GMT
Hi Richard

----- Original Message -----
From: "Richard Sand" <rsand@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:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>


Mime
View raw message