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

current node attribute as predicate

Subject: current node attribute as predicate
From: Antonie Botes <antonie.botes@xxxxxxxxxxx>
Date: Fri, 25 Oct 2002 11:17:26 +0100
current node predicate xslt
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 version="1.0" encoding="utf-8" ?>
	<item itemcode="Item1">
		<description>description 1</description>
	<item itemcode="Item2">
		<description>description 2</description>
		<purchase item="Item2" number="2" />
		<purchase item="Item1" number="1" />

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
	<xsl:template match="invoice">
		<xsl:apply-templates />
	<xsl:template match="purchase">
		<xsl:variable name="ItemText">
			<xsl:value-of select="@item" />
		<xsl:copy-of select="/inventory/item[@itemcode=$ItemText]"
	<xsl:template match="item" />

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

Current Thread


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.
First Name
Last Name
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.