[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: variable with node in xsl:choose

Subject: RE: variable with node in xsl:choose
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Tue, 23 Jul 2002 12:51:50 +0100
RE:  variable with node in xsl:choose
The solution to this one is devious:

<xsl:variable name="anzrows"
  select="//user/nokeyuser/name[test=$anznokeyuser] |
          //user/keyuser/name[test!=$anznokeyuser]"/>

Of course, in XPath 2.0 you get a proper conditional expression...

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> inchi2000@xxxxxx
> Sent: 23 July 2002 10:59
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  variable with node in xsl:choose
> 
> 
> Hello,
> 
> first thanks for your helpful reponse to my old question.
> Now my new one:
> I want to use a variable in a for:each... so it works fine:
> 
> <xsl:variable name="anzrows" select="//user/nokeyuser/name"/>
> <xsl:for-each select="$anzrows">
> 
> But I want the select in the variable choosen by a condition 
> like this:
> 
> <xsl:choose>
>    <xsl:when test="$anznokeyuser > $anzkeyuser"><xsl:variable 
> name="anzrows"
> select="//user/nokeyuser/name"/></xsl:when>
>    <xsl:otherwise><xsl:variable name="anzrows"
> select="//user/keyuser/name"/></xsl:otherwise>
> </xsl:choose>
> 
> I also tried it like this:
> 
> <xsl:variable name="anzrows">
> <xsl:choose>
>    <xsl:when test="$anznokeyuser >
> $anzkeyuser">//user/nokeyuser/name</xsl:when>
>    <xsl:otherwise>//user/keyuser/name</xsl:otherwise>
> </xsl:choose>
> </xsl:variable>
> 
> But this doesn't work because he can't convert #RTREEFRAG 
> into NodeList.
> Maybe you can help another time :)
> 
> Thanks,
> Markus
> 
> -- 
> GMX - Die Kommunikationsplattform im Internet.
> http://www.gmx.net
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.