Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XSLT template in another file

Tags:

templates

xslt

Can I call another xslt template file that is reusable for/by other XSLT files. More like a common file/Helper xslt.( i am specifically using templates)

like image 741
Greens Avatar asked May 16 '11 20:05

Greens


People also ask

How do I call one XSLT from another?

Use xs:include to bring in another stylesheet as a separate part of the one you're writing; use xs:import to bring in another stylesheet like or based on the one you're writing such that you'd like to override templates. For more details on xs:include vs xs:import , see: Combining Stylesheets with Include and Import.

How do you call a template in XSLT?

By invoke, we mean that the named template is called and applied to the source document. If a template does not have a name, it cannot be called by this element. The xsl:template element is used to create a template. You can name a template by using the name attribute of the xsl:template element.

What is XSLT template match?

The <xsl:template> element is used to build templates. The match attribute is used to associate a template with an XML element. The match attribute can also be used to define a template for the entire XML document. The value of the match attribute is an XPath expression (i.e. match="/" defines the whole document).

What is the difference between call template and apply template in XSLT?

With <xsl:apply-templates> the current node moves on with every iteration, whereas <xsl:call-template> does not change the current node. I.e. the . within a called template refers to the same node as the . in the calling template.


1 Answers

This is not XSLT 2.0 - specific question.

Both in XSLT 1.0 and XSLT 2.0 you can use the directives:

<xsl:import>

and

<xsl:include>

like image 160
Dimitre Novatchev Avatar answered Oct 20 '22 22:10

Dimitre Novatchev