Laurent,
Jarno suggested using xsl:copy-of, and you reported it placed the value of
your attribute into element content.
Are you sure you said copy-of, not value-of? xsl:value-of would give the
result you reported, but xsl:copy-of would (as Jarno said) copy the
attribute as an attribute (not place its value into the content).
At 04:50 AM 10/22/2003, you wrote:
I'done
<xsl:template match="* | @*">
<xsl:copy>
<xsl:apply-templates select="Attributes"/>
<xsl:apply-templates select="* | @* | text()"/>
</xsl:copy>
</xsl:template>
and it seems to work now.
This works because you are selecting attributes (select="@*") and also
matching them with the same template, which copies them.
The line <xsl:apply-templates select="Attributes"/> is, however, spurious.
It's not doing anything at all, since you don't have any child elements
named "Attributes" -- and if you did, it would break your stylesheet and
your actual attributes would fail to be copied, since they are being copied
by the next instruction <xsl:apply-templates select="* | @* | text()"/>,
and you can't add attributes to an element node after other things have
been placed in its content (as would presumably happen if you had element
children named "Attributes").
So you probably want to delete that line (try it; it will still work) ...
and maybe go back to Jarno's idea as it's a bit tighter (albeit a little
less adaptable).
Cheers,
Wendell
======================================================================
Wendell Piez
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list