|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] How to use xsl:key to get all values?
Hi,
Based on the following XML and XSL file, I'd like to output "1" "2". But I
just get "1" "1". Any body can tell me what is wrong with
<xsl:key>
Thanks in advance!
Di
<?xml version="1.0"?>
<AA>
<BB>
<CC>
<DD>
<EE aField="a1" value="1"/>
</DD>
</CC>
<CC>
<DD>
<EE aField="a1" value="2"/>
</DD>
</CC>
</BB>
</AA>
<?xml version="1.0"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/WD-xsl" version="1.0">
<xsl:output method="text"/>
<xsl:key name="key-name" match="EE" use="@aField" />
<xsl:template match="AA/BB">
<xsl:for-each select="CC">
<xsl:variable name="child" select="key('key-name', 'a1')" />
<xsl:value-of select="$child/@value" />
</xsl:for-each>
</xsl:template>
</xsl:transform>
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
|

Cart








