Re: [xsl] How to I keep attributes names and values in a sort?

Subject: Re: [xsl] How to I keep attributes names and values in a sort?
From: "Mark Wilson" <mark@xxxxxxxxxxxx>
Date: Sun, 20 Jul 2008 09:17:31 -0700
Thank you. Sorry I repeated the post, but I did not receive Martin's earlier reply. Appreciate your comments.
REgards,
mark


--------------------------------------------------
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Sent: Sunday, July 20, 2008 9:13 AM
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [xsl] How to I keep attributes names and values in a sort?

On 7/20/08, Mark Wilson <mark@xxxxxxxxxxxx> wrote:
When I use
the styles sheet in listing 1, I get the concatenated value of the
attributes within the start tag, but not the attribute names as in  <Cat
135> instead of <Cat pofis="1" pofis-number="35">.

It's hard to believe that you can get an output like, <Cat 135> from the stylesheet. This is not a well-formed XML.

This syntax,

<xsl:template match="*">
  <xsl:copy>
     <!-- something here -->
  </xsl:copy>
</xsl:template>

would make a shallow copy of the contextual element (i.e., you don't
get the attributes copied, and the child contents).

To copy attributes as well, you need to do,

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

as Martin wrote in an earlier reply.


-- Regards, Mukul Gandhi

Current Thread