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

keys with composite values

Subject: keys with composite values
From: "Borenstein, Philip" <pb@xxxxxxxxxx>
Date: Thu, 18 Jul 2002 17:08:42 -0400
composite values
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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