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

Re: Grouping upon various attribute values

Subject: Re: Grouping upon various attribute values
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 16 Aug 2006 16:13:10 +0100
Re:  Grouping upon various attribute values
  <foo a="a" b="b"/>

  and

  <foo b="b" a="a"/>

  are semantically equivalent but the result of string-join(@*,'-')
  would (I think, most of the time) be different, 

depends on the parser ,some routinely stuff attributes in some kind of
hash table and so report them in an order unrelated to the order that
they appear in the file.

However Michael's observation is correct that in this case what matters
is not that the attributes on the same element are reported in the same
order, but that similarly named attributes on different elements are
reported in the same order, and for that you need to sort.

group-by="f:key(@*)" 

<xsl:function name="f:key">
  <xsl:param name="nodes" as="item()*"/>
  <xsl:value-of separator="|">
  <xsl:perform-sort select="$nodes">
  <xsl:sort select="name()"/>
  </xsl:perform-sort>
  </xsl:value-of>
</xsl:function>

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-2011 All Rights Reserved.