Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

XSLT <xsl:apply-imports> elemens


May 28, 2021 XSL T


Table of contents


XSLT slt;xsl: apply-imports

the use of an externally imported XSL as Template.


XSLT <xsl:apply-imports> elemens Complete XSLT element reference manual

Definitions and usages

The element can be applied to template rules from the import style sheet.

The template rules in the import style sheet have a lower priority than the template rules in the main style sheet. If you want to use a template rule in the import style sheet instead of an equivalent rule in the main style sheet, you'll use the element of the .lt;xsl:apply-imports.


Grammar

<xsl:apply-imports/>

Property

No

Suppose we have a style sheet called "standard.xsl" that contains template rules for message elements:

<?xml version="1.0" encoding="ISO-8859-1"?>
<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 style sheet can import "standard.xsl" and modify the message element as follows:

<?xml version="1.0" encoding="ISO-8859-1"?>
<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 is a message that is converted into a form element:

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


XSLT <xsl:apply-imports> elemens Complete XSLT element reference manual