Is there any way of server side include XSLT file?
I mean that the output of one file is shown in the second file?
For example:
Main XSLT file:
<xsl:template match="pt">
<xsl:comment>#include virtual="a.xsl"</xsl:comment>
</xsl:template>
Second XSLT file a.xslt
:
<xsl:template match="a">
<xsl:variable name="ab" select="'ss'"/>
<p><xsl:value-of select="$ab"/></p>
</xsl:template>
Now output will be
ss in
p
tag
Why I am doing it like this is because I break my pages into multiple components after that I include their output in the main XSLT file. Each XSLT file has individual XML data.
You can't use the output of an XSLT stylesheet as input to transform it again in vanilla XSLT 1.0 in a single stylesheet.
You either need to run the XSLT processor twice, using the result of the first pass as input for the second, or you need to use a processor that supports something like
node-set()
, which allows to convert a result tree fragment back to a node-set for further processing.https://www.xml.com/pub/a/2003/07/16/nodeset.html
You can include arbitrary XML in the output however, as long as it is valid XML, using the
document()
function.stylesheet.xslt
some.xml
Result