Peter Desjardins wrote:
I rewrote my stylesheet so it transforms instead of copies. Is this
something like what you meant?
Peter
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="root">
<xsl:element name="section" namespace="http://docbook.org/ns/docbook">
<xsl:attribute name="version">5.0</xsl:attribute>
<xsl:attribute name="xml:id">myIdentifier</xsl:attribute>
<xsl:apply-templates />
</xsl:element>
</xsl:template>
<xsl:template match="*">
<xsl:variable name="elementName">
<xsl:value-of select="name()" />
</xsl:variable>
<xsl:element name="{$elementName}"
namespace="http://docbook.org/ns/docbook">
<xsl:for-each select="@*">
<xsl:copy-of select="." />
</xsl:for-each>
<xsl:apply-templates />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
I would shorten that to
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://docbook.org/ns/docbook">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="*">
<xsl:element name="{local-name()}">
<xsl:copy-of select="@*" />
<xsl:apply-templates />
</xsl:element>
</xsl:template>
<xsl:template match="root">
<section version="5.0" xml:id="myIdentifier">
<xsl:apply-templates />
</section>
</xsl:template>
</xsl:stylesheet>
--
Martin Honnen
http://msmvps.com/blogs/martin_honnen/
--~------------------------------------------------------------------
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>
--~--