Re: [xsl] Conditional use of <xsl:apply-imports> or <xsl:import> XSLT 2.0

Subject: Re: [xsl] Conditional use of <xsl:apply-imports> or <xsl:import> XSLT 2.0
From: "Vladimir Nesterovsky" <vladimir@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 12 Jul 2008 18:02:45 +0300
3. Finally, is this a correct method to approach?

It does not appear on the surface to be incorrect. On the other hand, you
haven't provided many particulars.

Am I correct that you have a variable choosing where <xsl:apply-imports/> should go?


If yes, then you may define a selector element, and create an indirect call to dispatch processing.

main style:

<xsl:variable name="selector" as="element">
 <xsl:element name="{define a selector here}"/>
</xsl:variable>

...

<xsl:template match="article/meta/journalcode[.='ABCD' | 'EFGH' | 'IJKL' |
'LMNO']">

<xsl:apply-templates mode="call" select="$selector">
<xsl:with-param name="context-item" select="."/> </xsl:apply-templates>
</xsl:template>


import style 1:

<xsl:template mode="call" match="style 1 selector">
<xsl:with-param name="context-item" select="."/>


 <xsl:apply-templates select="$context-item"/>
</xsl:template>

...

import style N:

<xsl:template mode="call" match="style N selector">
<xsl:with-param name="context-item" select="."/>


 <xsl:apply-templates select="$context-item"/>
</xsl:template>

--
Vladimir Nesterovsky

Current Thread