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

Re: Including an attribute discriminator in the for-e

Subject: Re: Including an attribute discriminator in the for-each-group's group-by attribute
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Fri, 25 Jul 2008 16:57:30 +0200
Re:  Including an attribute discriminator in the  for-e
Mark Wilson wrote:
I have two elements that differ only by attribute. My for-each-group code currently considers them to be identical, so I need to distinguish them by their attributes as well as their text node. I do not know enough about XPath yet to construct a proper current-grouping-key(). (I'm reading Michael Kay's 4th edition, but have not covered the XPath section yet). Everything I have tried with | @* has failed.

The two elements that need to be distinguished are:

<Heading entry="author">Hahn, Henry</Heading>
<Heading entry="subject">Hahn, Henry</Heading>

The code snippet is:

<xsl:for-each-group select="Item" group-by="Heading" collation="{$sorting-collation}">
<xsl:sort select="current-grouping-key()" collation="{$sorting-collation}"/>

I am not sure I understand what you want to achieve.
If you want group by the Heading elements which have an attribute entry="author" then you can do that with
<xsl:for-each-group select="Item" group-by="Heading[@entry = 'author']">




--

	Martin Honnen
	http://JavaScript.FAQTs.com/

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.