This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: XSL Filtering
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: XSL Filtering
- From: Linda van den Brink <lvdbrink at baan dot nl>
- Date: Tue, 8 Aug 2000 12:23:02 +0200
- Reply-To: xsl-list at mulberrytech dot com
For the sample XML you posted,
>
> <TABLE>
> <RECORD>
> <TYPE>Red Barn</TYPE>
> <COST>$195</COST>
> <SKU>JHD384234</SKU>
> <AVAIL>No</AVAIL>
> </RECORD>
> </TABLE>
The following works:
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">
<table>
<xsl:for-each select="TABLE/RECORD[contains(TYPE,'Barn')]">
<tr>
<td><xsl:value-of select="TYPE"/></td>
<td><xsl:value-of select="COST"/></td>
<td><xsl:value-of select="SKU"/></td>
<td><xsl:value-of select="AVAIL"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
There were several errors in the code you posted.
- You were looking for a DESCRIPTION elemement that contained 'Barn', but
there is no such element in your source. I guess you mean TYPE.
- You were looking for the string 'Barn' but in your source it was written
in all caps, 'BARN'. That would not result in a match.
- Your <xsl:value-of select=""/> weren't closed.
Hope this helps,
Linda
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list