[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: XSL Filtering
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
|
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
|