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

Re: Chewy key problem

Subject: Re: Chewy key problem
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 1 Mar 2005 21:22:55 GMT
xpath key problem
> Consider me to have asked again. 
Still I'll avoid answering that (because explaining the 2 pass version
is easier:-)first do an identity template

<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>

Then add a template to work out your sorting key which is, I think

<xsl:template match"b">
<xsl:copy-of select="@*"/>
<xsl:variable name="x">
<xsl:copy-of select=".//desc"/>
</xsl:variable>
<b sort="$x">
<xsl:apply-templates/>
</b>
</xsl:template>


that's all you need the first transform, now you have an intermediate
file that's like your original except every b has a sort attribute.
Now you can just sort/group on that as usual as described in
www.jenitennison.com/xslt/grouping.
You are in a better situation now as your grouping key is just a singke
Xpath @sort.


If you are doing this from java you should be able to avoid the costs of
writing out the intermediate document as a file and parsing it back
again and just pass it as an in memory object from the first transform
to the next. The details of that depend on the API you are using (and
anyway there are others who can tell you a lot more about java.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.