Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
This example copies the <myElement> element and adds a copied attribute with the value "true".
XML File (myelem.xml)
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="attrcopied.xsl" ?>
<root>
<myElement>My Data</myElement>
<myElement>My Other Data</myElement>
</root>
XSLT File (attrcopied.xsl)
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="myElement">
<xsl:copy>
<xsl:attribute name="copied">true</xsl:attribute>
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Output
This is the formatted output:
My DataMy Other Data
The following is the processor output, with line breaks added for clarity.
<?xml version="1.0"?>
<myElement copied="true">My Data</myElement>
<myElement copied="true">My Other Data</myElement>