xsl-list
[Top] [All Lists]

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

2008-07-20 09:14:08
On 7/20/08, Mark Wilson <mark(_at_)knihtisk(_dot_)org> 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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>