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

RE: XSL Filtering

Subject: RE: XSL Filtering
From: Linda van den Brink <lvdbrink@xxxxxxx>
Date: Tue, 8 Aug 2000 12:23:02 +0200
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


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.