[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How to use xsl:key to get all values?
Hello Di,
At 10:45 PM 4/12/01, you wrote: Hi, Nothing's wrong with it, it's working fine. xsl:key indexes nodes across the entire document. When you write <xsl:variable name="child" select="key('key-name', 'a1')" /> You are setting the variable $child to be *all* the nodes that match the key with key value 'a1'. In your example, there are two such nodes, and you always get both of them regardless of the context node (since the value you give is always 'a1'). When you ask for <xsl:value-of select="$child/@value" /> You get the value of the node set, which is defined as the string value of the first node in the node set in document order. That's always the same node, the one with value='1', because the node set is always the same and document order doesn't change either. It's unclear why you are using the key. Why not just: <xsl:for-each select="CC"> <xsl:value-of select="DD/EE/@value" /> </xsl:for-each> ? Hope that helps, Wendell p.s. what's that namespace declaration xmlns="http://www.w3.org/TR/WD-xsl" doing for you anyhow? <?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>
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
|