Antonie
If you don't want to use a variable, you could do:
<xsl:variable name="ItemText">
<xsl:value-of select="@item" />
</xsl:variable>
<xsl:copy-of select="/inventory/item[(_at_)itemcode=$ItemText]"
<xsl:copy-of select="/inventory/item[(_at_)itemcode=current()/@item]"/>
Kind regards,
James Carlyle
FableFlow : MMS templating and delivery
Multimedia Messaging commentary : http://www.fableflow.com/weblog/
Telephone : +44 (0)20 7813 0665
-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com]On Behalf Of
Antonie Botes
Sent: 25 October 2002 11:17
To: 'XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com'
Subject: [xsl] current node attribute as predicate
I use only a subset of the XML file to be processed as templates. The rest
of the XML is source data from which to read certain values relating it to
the current node via an attribute of the current node. The only way I know
of that works is using a variable to which I assign the attribute, then by
using the variable in the predicate. Apologies if this is a really basic
question. Here is an example:
XML
________________________________________
<?xml version="1.0" encoding="utf-8" ?>
<inventory>
<item itemcode="Item1">
<price>10.50</price>
<description>description 1</description>
</item>
<item itemcode="Item2">
<price>20.00</price>
<description>description 2</description>
</item>
<invoice>
<date>19/12/2002</date>
<purchase item="Item2" number="2" />
<purchase item="Item1" number="1" />
</invoice>
</inventory>
XSLT
_____________________________________________________
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="invoice">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="purchase">
<xsl:copy-of select="/inventory/item[(_at_)itemcode=$ItemText]"
/>
</xsl:template>
<xsl:template match="item" />
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list