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

RE: XSLT Sort - returning attributes

Subject: RE: XSLT Sort - returning attributes
From: David Neary <David@xxxxxxxxx>
Date: Fri, 16 May 2003 13:17:51 +0200
xslt sort apply templates
> Basically from the above example, " <xsl:apply-templates 
> select="*"/> " will
> return me all the elements of the book node, however I also 
> want to retrieve
> all attributes.
> I 've tried  "   <xsl:apply-templates select="@*"/>  " to get all
> attributes, but obviously Im doing something wrong.
> Is there any simpler way of  going about sorting an xml doc 
> and returning
> the entire document in XML format (only sorted) ?

The identity transformation is...

<xsl:template match="node() | @*">
  <xsl:copy>
    <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>

You could do a template for the root something like this...

<xsl:template match="/">
  <xsl:apply-templates select="node() | @*">
    <xsl:sort select="node whose value you want to use in sort"/>
  </xsl:apply-templates>
</xsl:template>

Add in the identity template and you're away in a hack.

Cheers,
Dave.

 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.