XSL Filtering

Subject: XSL Filtering
From: "Bryce Wells" <bryce@xxxxxxxxxxxxxxxx>
Date: Mon, 7 Aug 2000 22:52:41 -0500
Every time I run a filter on my data set like the one below:
<xsl:for-each select="TABLE/RECORD[contains(DESCRIPTION,'BARN')]">

It returns the correct number of nodes that fit that parameter (have barn in
their description), but I can't get any of the other values in each of those
node sets to display correctly.

For instance, with this small example XML:

<TABLE>
    <RECORD>
        <TYPE>Red Barn</TYPE>
        <COST>$195</COST>
        <SKU>JHD384234</SKU>
        <AVAIL>No</AVAIL>
    </RECORD>
</TABLE>

when I run the above filter, it brings back 14 out of a possible 300 - which
I know because I am rendering the return tree in an HTML table and it gives
me 14 'Barns' as separate rows.

However, there is other information that I want displayed, namely the Cost,
SKU and Avail - but they simply won't populate the table.

Here is the example XSL:

<xsl:for-each select="TABLE/RECORD[contains(DESCRIPTION,'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>

This gives me a table with 14 rows (good), with the each of the 14 barns
listed under the TYPE column (good), but no data under the Cost, Sku, or
Avail columns (bad!).

If I do something like this,
                <td><xsl:value-of select="//COST"></td>

I get COST data to appear in all 14 rows, but it is the data of only the
first node in my data set, and not even the data for the first node that fit
the filter parameter.

I've tried to follow numerous examples posted on the web doing similar sorts
of things, but to no avail, any pointers would be much appreciated.

Bryce




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread