This is the mail archive of the xsl-list@mulberrytech.com mailing list .
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I'm getting some unexpected results with keys that use composite values. The problem, distilled to the minimum looks like this: I want to retrieve the FEATURE elements that satisfy particular VERSIONs. For example, if I specify version 1.0, I want to get both 'Slices' and 'Dices'. If I specify version 1.1, I want only 'Slices'. I use a composite key for the version. It seems I should be able to say key('features', '10') for version 1.0 features and key('features', '11') for version 1.1 features. What I get depends on the other of VERSION elements: key('features', '11') => Slices key('features', '10') => Dices (but not Slices) If I switch the VERSION elements in the 'Slices' FEATURE: key('features', '11') => empty key('features', '10' => Slices and Dices This happens in both Saxon and MSXSL, so I'm guessing there's something I'm not understanding about keys with composite values. XML source: <FEATURES> <FEATURE NAME="Slices"> <VERSION MAJOR="1" MINOR="1"/> <VERSION MAJOR="1" MINOR="0"/> </FEATURE> <FEATURE NAME="Dices"> <VERSION MAJOR="1" MINOR="0"/> </FEATURE> </FEATURES> XSLT stylesheet: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:key name="features" match="FEATURE[VERSION]" use="concat(VERSION/@MAJOR,VERSION/@MINOR)"/> <xsl:template match="FEATURES" > <CONTENT> <xsl:copy-of select="key('features', '11')" /> </CONTENT> </xsl:template> </xsl:stylesheet> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |