(
Continuing my theme of trying to understand how to do things in XSLT that were fairly easy to do in PTs...)
Environment[indent]TS 671SP1 Solaris 10 (or 672 W2K)
Using XSLT presentation templates - no Perl (sigh)[/indent]
Scenario[indent]I have a DCT which contains N fields of "common" content, and several fields of content that should only end up in the output if the DCR is being processed for a given target (vague, I know, but don't worry about it too much right now)
Currently, I have two XSLT files - one that formats all the common content, and one that formats all the common content
plus the target-specific content. For reasons that I won't go into right now, I cannot use conditional coding within a single XSLT file for handling this target-specific aspect - I will have two (or more)
registered XSLTs for the data-type. For example (the highlighted part is in one, but not the other XSLT file):
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" ...>
<xsl
utput method="xml" indent="yes" .../>
<xsl:template match="/record">
<html>
<xsl:call-template name="HEAD"/>
<body>
<xsl:call-template name="TOP"/>
<xsl:call-template name="TOP2"/>
...
<xsl:call-template name="BOTTOM"/>
</body>
</html>
</xsl:template>
<xsl:template name="HEAD">
<head>
<title><xsl:value-of select="/record/title"/></title>
...
</head>
</xsl:template>
<xsl:template name="TOP">
<xsl:for-each select="/record/summary">
<p><xsl:value-of select="."/></p>
</xsl:for-each>
</xsl:template>
<xsl:template name="TOP2">
<xsl:for-each select="/record/special">
<p><xsl:value-of select="."/></p>
</xsl:for-each>
</xsl:template>
...
<xsl:template name="BOTTOM">
<xsl:for-each select="/record/closing">
<p><xsl:value-of disable-output-escaping="yes" select="."/></p>
</xsl:for-each>
...
</xsl:template>
</xsl:stylesheet>
If I have these as two distinct files, with all of the common code replicated within each file - it works just fine. However, as one might imagine, I'd rather move all those template definitions, after the first one, to a separate file so I don't have to replicate them. Essentially, I'm looking to do this (highly abridged):
<?xml version="1.0" encoding="utf-8"?>
<!-- XSLT-COMMON -->
<xsl:stylesheet version="1.0" ...>
<xsl:template name="HEAD">...</xsl:template>
<xsl:template name="TOP">...</xsl:template>
<xsl:template name="TOP2">...</xsl:template>
...
<xsl:template name="BOTTOM">...</xsl:template>
</xsl:stylesheet>
and:
<?xml version="1.0" encoding="utf-8"?>
<!-- XSLT-1 (XSLT-2) -->
<xsl:stylesheet version="1.0" ...>
<xsl
utput method="xml" indent="yes" .../>
<xsl:template match="/record">
<html>
<xsl:call-template name="HEAD"/>
<body>
<xsl:call-template name="TOP"/>
<xsl:call-template name="TOP"/>
...
<xsl:call-template name="BOTTOM"/>
</body>
</html>
</xsl:template>
[/indent]
Problem[indent]I've tried various combinations of: