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

XSLT Sort - returning attributes

Subject: XSLT Sort - returning attributes
From: karloswart@xxxxxxxxxxxxxx
Date: Fri, 16 May 2003 11:35:20 +0100
xslt sort
PLAT: WIN2K
MSXML2.Domdocument40
using 'transformNodeToObject'
Hi, very simply Im trying to do a plain sort on my XML Doc.
I want to return the XML doc in exactly the same format that it was input
into, simply sorted.

Using Microsoft's MSDN example:
XML FILE
<?xml version="1.0"?> 
<COLLECTION dateCreated="01-04-2000"> 
<BOOK PK="2" > 
	<TITLE>Splish Splash</TITLE> 
	<AUTHOR>Paula Thurman</AUTHOR> 
	<PUBLISHER>Scootney</PUBLISHER> 
</BOOK> 
<BOOK PK="1" > 
	<TITLE>Splish Splash</TITLE> 
	<AUTHOR>Paula Thurman</AUTHOR> 
	<PUBLISHER>Scootney</PUBLISHER> 
</BOOK> 
</COLLECTION>
XSL STYLESHEET
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
   <PriceList>
      <xsl:for-each select="COLLECTION/BOOK">
   <xsl:sort select="@PK" data-type="number"/>
   <xsl:copy>
   <xsl:apply-templates select="*"/>
   <xsl:apply-templates select="@*"/> [my inserted line]
   </xsl:copy>
      </xsl:for-each>
   </PriceList>
  </xsl:template>

  <xsl:template match="*">
   <xsl:copy>
   <xsl:apply-templates />
   </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

END

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) ?

thanks
Karlo Swart










 


 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.