xsl:apply-imports

Syntax

<xsl:apply-imports/>


Postition

innerhalb des Template-Bodys


Attribute
keine

<xsl:apply-imports>

wird in Verbindung mit dem importierten Stylesheet verwendet. Ist ein spezifisches Template des importierten Stylesheets überschrieben worden, kann der Prozessor mit dieser Instruktion trotzdem zur Ausführung dieses Templates gezwungen werden.


Definition

XSLT Kapitel 5.6


Beispiel

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

<xsl:output method="html"/>

<xsl:import href="product.xsl"/>

<xsl:template match="/">
     <HTML>
          <HEAD>
               <TITLE>Element: &lt;apply-imports&gt; / Beispiel 01</TITLE>
          </HEAD>
          <BODY>
               <xsl:apply-templates select="shop"/>
          </BODY>
     </HTML>
</xsl:template>

<xsl:template match="shop">
     <TABLE BORDER="1">
          <TR>
               <TH WIDTH="150">Abteilung:</TH>
               <TH WIDTH="100">Artikel:</TH>
               <TH WIDTH="100">Preis:</TH>
          </TR>
     </TABLE>
     <xsl:apply-imports/>
</xsl:template>

</xsl:stylesheet>


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- product.xsl -->

<xsl:output method="html"/>

<xsl:template match="/">
     <HTML>
          <HEAD>
               <TITLE>product.xsl</TITLE>
          </HEAD>
          <BODY>
               <xsl:apply-templates select="shop"/>
          </BODY>
     </HTML>
</xsl:template>

<xsl:template match="shop">
     <xsl:comment> product.xsl </xsl:comment>
     <xsl:apply-templates select="order/product"/>
</xsl:template>

<xsl:template match="product">
     <TABLE>
          <TR>
               <TD WIDTH="150"><xsl:value-of select="@department"/></TD>
               <TD WIDTH="100"><xsl:value-of select="name"/></TD>
               <TD WIDTH="100" ALIGN="RIGHT">
                    <xsl:value-of select="price"/>
                    <xsl:text> </xsl:text>
                    <xsl:value-of select="currency"/>
               </TD>
          </TR>
     </TABLE>
</xsl:template>

</xsl:stylesheet>


© 2001 by Timo Schäfer