I have two (or more) templates for one certain tag:
The first one:
tobeimported.xsl:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:netzquantum="http://NetzQuantum"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="netzquantum xhtml"
<xsl:output method="xml"
cdata-section-elements="xhtml:script"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
encoding="iso-8859-1"/>
<xsl:template match="xhtml:html/xhtml:body">
<xsl:copy>
<p>This is the result of the first template</p>
<xsl:apply-templates select="*|@*|text()|processing-instruction()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*|@*|text()|processing-instruction()">
<xsl:copy>
<xsl:apply-templates select="*|@*|text()|processing-instruction()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
--------------------------------------
The second one:
importing.xsl:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:netzquantum="http://NetzQuantum"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="netzquantum xhtml"
<xsl:import href="tobeimported.xsl"/>
<xsl:output method="xml"
cdata-section-elements="xhtml:script"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
encoding="iso-8859-1"/>
<xsl:template match="xhtml:html/xhtml:body">
<xsl:copy>
<p>This is the result of the second template</p>
<xsl:apply-templates select="*|@*|text()|processing-instruction()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
-----------------------------------------
The second template is now to be applied to an XHTML document. The
result should look sth like this:
<html><head>...</head>
<body>
<p>This is the result of the second template</p>
<p>This is the result of the first template</p>
</body>
</html>
My question is:
How can I apply the second template on the *result* of the first one?
While it might be trivial to get the same result as if it was applied on
the result of the first one I this example does not reflect the true
depth of my problem. Both templates (and more will come) will do more
complex transformations (like adding attributes to xhtml:body, analysing
stuff and so on).
Any ideas?
Thanks in advance
Bernd Fuhrmann