xsl:import - ( XSLT Core Elements )
The xsl:import
element is used to include one stylesheet into another stylesheet. It can be used to reuse the common functionalities of one stylesheet in another stylesheet.
Syntax
<xsl:import href="URL"/>
Example
<xsl:import href="common.xsl"/>
<xsl:template match="/">
<xsl:apply-templates select="data"/>
</xsl:template>
In the above example, the common.xsl
stylesheet is included in the current stylesheet using the xsl:import
element. The root element of the current stylesheet is matched with the template element and the data element is selected and passed to the apply-templates
element.
Output
There is no output for the xsl:import
element as it is used to include one stylesheet into another stylesheet and reuse the functionalities.
Explanation
The xsl:import
element is used to include one stylesheet into another stylesheet. It helps in code reusability as it allows common functionalities of one stylesheet to be reused in another stylesheet. The href
attribute is used to specify the URL of the stylesheet to be included.
Use
The xsl:import
element is used when we want to include one stylesheet into another stylesheet and reuse the common functionalities of one stylesheet in another stylesheet.
Important Points
- The
xsl:import
element is used to include one stylesheet into another stylesheet. - It helps in code reusability as it allows common functionalities of one stylesheet to be reused in another stylesheet.
- The
href
attribute is used to specify the URL of the stylesheet to be included.
Summary
The xsl:import
element is used to include one stylesheet into another stylesheet. It helps in code reusability as it allows common functionalities of one stylesheet to be reused in another stylesheet. The href
attribute is used to specify the URL of the stylesheet to be included.