This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
variable in filter doesn't work??
- From: "Carter, Will" <WCarter at envestnetpmc dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Fri, 20 Sep 2002 11:24:14 -0500
- Subject: [xsl] variable in filter doesn't work??
- Reply-to: xsl-list at lists dot mulberrytech dot com
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