xsl-list
[Top] [All Lists]

RE: XSLT Sort - returning attributes

2003-05-16 04:17:51

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