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: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Sun, 20 Jul 2008 21:43:43 +0530
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