xsl:processing-instruction

Syntax

<xsl:processing-instruction>
     Template-Body
</xsl:processing-instruction>


Postition

innerhalb des Template-Bodys


Attribute
Bezeichnung Wert Bedeutung
name QName Name der generierten Prozessinstruktion

<xsl:processing-instruction>

generiert einen Prozessinstruktionsknoten an die aktuelle Position des Output-Dokuments.


Definition

XSLT Kapitel 7.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