xsl:stylesheet id="stylesheet" exclude-result-prefixes="x2 lit" version="1.0" xml:lang="en"copy-xhtml1: copy an XHTML2 element as an XHTML1 elementcopy@*: copy attributescopy-idtemplate: duplicates the ID attribute
copy-xhtml1: copy an XHTML2 element as an XHTML1 elementThis copies a XHTML2 element but changes its XML namespace to XHTML1. This can obviously be done if the given element in XHTML2 has the same semantics as the element of the same name in XHTML1.
The XHTML2 → XHTML1 name mapping is not recursive by default, so that it is possible that translation only for applicable elements and handle the rest of the elements by other templates.
xsl:template name="copy-xhtml1" xsl:param name="target" select="." xsl:param name="tag-name" select="local-name($target)" xsl:param name="content" xsl:apply-templates select="$target/node()" xsl:element name="{$tag-name}" namespace="http://www.w3.org/1999/xhtml" xsl:apply-templates select="@*" mode="copy" xsl:copy-of select="$content"
copy @*: copy attributesThis copies the selected attribute value to the output with no change.
xsl:template match="@*" mode="copy" xsl:copy xsl:value-of select="."
copy-id template: duplicates the ID attributeThis copies only the ID attribute if it exists on the source node. If it does not exist, the ID is generated.
xsl:template name="copy-id" xsl:param name="target" select="." xsl:attribute name="id" xsl:call-template name="id" xsl:with-param name="target" select="$target"
Formatted using xhtml2to1 by Steve Cheng.