YouTip LogoYouTip

El Apply Imports

XSLT Element

XSLT Element

XSLT Tutorial | XSL Language | XSLT Introduction | XSLT Browsers | XSLT Transformation | XSLT Element | XSLT Element | XSLT Element | XSLT Element | XSLT Element | XSLT Element | XSLT Element | XSLT in Client-side | XSLT in Server-side | XSLT - Edit XML | XML Editors | XSLT Summary | XSLT Examples | XSLT Elements Reference Manual | XSLT Functions | XSLT Conversion Tool

Definition and Usage

The element applies template rules from an imported stylesheet.

Template rules from an imported stylesheet have lower priority than those in the main stylesheet. If you want to use a template rule from an imported stylesheet instead of an equivalent one in the main stylesheet, you would use the element.

Syntax

<xsl:apply-imports/>

Attributes

No attributes

Example

Assume we have a stylesheet named "standard.xsl", which contains a template rule for the message element:


<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="message">
<h2><xsl:apply-templates/></h2>
</xsl:template>
</xsl:stylesheet>

Another stylesheet imports "standard.xsl" and modifies the message element as follows:


<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="standard.xsl"/>
<xsl:template match="message">
<div style="border:solid blue">
<xsl:apply-imports/>
</div>
</xsl:template>
</xsl:stylesheet>

The result will convert a message into a form element:

<div style="border:solid blue"><h2>...</h2></div>

Β© 2023 . All rights reserved.

← El Apply TemplatesXpath Functions β†’