[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: variable in filter doesn't work??
Try this: <xsl:variable name="filter" select="//person[cat = 'zoro']"/> <!-- <xsl:value-of select="$filter"/> --> <tr> <td><xsl:value-of select="$filter/cat"/></td> <td><xsl:value-of select="$filter/dog"/></td> <td><xsl:value-of select="$filter/fish"/></td> </tr> The variable contains a result tree fragment that contains the nodes listed. You need to then apply X-Path against the variable to get the node values out. -----Original Message----- From: Carter, Will [mailto:WCarter@xxxxxxxxxxxxxxxx] Sent: Friday, September 20, 2002 11:24 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: variable in filter doesn't work?? when I put a variable in a filter I am having problems... here is my xml: ----------------------- <people> <person name="george"> <cat>zoro</cat> <dog>butch</dog> <fish>jaws</fish> </person> <person name="jennifer"> <cat>felix</cat> <dog>fido</dog> <fish>moby</fish> </person> <person name="simon"> <cat>tom</cat> <dog>scooby</dog> <fish>conroy</fish> </person> </people> ----------------------- this xsl works properly (it sorts out all except for when cat='zoro': ----------------------- <xsl:for-each select="//person[cat = 'zoro']"> <tr> <td><xsl:value-of select="cat"/></td> <td><xsl:value-of select="dog"/></td> <td><xsl:value-of select="fish"/></td> </tr> </xsl:for-each> ----------------------- output: zoro butch jaws why doesn't this work? ----------------------- <xsl:variable name="filter" select='"cat = 'zoro'"'/> <xsl:value-of select="$filter"/> <tr> <td><xsl:value-of select="cat"/></td> <td><xsl:value-of select="dog"/></td> <td><xsl:value-of select="fish"/></td> </tr> </xsl:for-each> ----------------------- output: zoro butch jaws felix fido moby tom scooby conroy I really trying to filter based on a parameter, if the parameter is empty, don't filter. If it is something, filter. thanks, will XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|