xsl:copy-of

Syntax

<xsl:copy-of/>


Postition

innerhalb des Template-Bodys


Attribute
Bezeichnung Wert Bedeutung
select Expression evaluiert ein Baumfragment, einen Knotenset oder eine beliebige Variable

<xsl:copy-of>

kopiert den Knoten und das abhängige Knotenset, mit den zugehörigen Namespaces und in der entsprechenden Reihenfolge innerhalb des Dokuments, an die aktuelle Position des Output-Dokuments.


Definition

XSLT Kapitel 11.3


Beispiel

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml"/>
    
<xsl:attribute-set name="product-info">
     <xsl:attribute name="name">
          <xsl:value-of select="name"/>
     </xsl:attribute>
     <xsl:attribute name="id-nr">
          <xsl:value-of select="id"/>
     </xsl:attribute>
</xsl:attribute-set>

<xsl:template match="/">
     <xsl:processing-instruction name="xml-stylesheet">
          <xsl:text>href="order.css" type="text/css"</xsl:text>
     </xsl:processing-instruction>
     <order>
          <xsl:apply-templates select="shop"/>
     </order>
</xsl:template>

<xsl:template match="shop">
     <xsl:copy-of select="customer"/>
     <xsl:apply-templates select="order/product"/>
</xsl:template>

<xsl:template match="product">
     <xsl:copy use-attribute-sets="product-info">
          <price>
               <xsl:value-of select="price"/>
               <xsl:text> </xsl:text>
               <xsl:value-of select="currency"/>
          </price>
          <amount>
               <xsl:value-of select="amount"/>
          </amount>
     </xsl:copy>
</xsl:template>

</xsl:stylesheet>


© 2001 by Timo Schäfer