Re: [xsl] name of the current mode

Subject: Re: [xsl] name of the current mode
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 14 Nov 2009 14:27:33 -0500
At 2009-11-14 20:25 +0100, Stefan Krause wrote:
is there any way to detect the name of the current mode during the
processing of the input document? I tried a approach over several
matching templates for each mode:

<xsl:function name="test:detect-mode">
        <xsl:variable name="temp_element" as="element()">
                <test:detect/>
        </xsl:variable>
        <xsl:apply-templates select="$temp_element" mode="#current"/>
</xsl:function>

<xsl:template match="test:detect" mode="#default">#default</xsl:template>
<xsl:template match="test:detect" mode="Mode_A">Mode_A</xsl:template>
<xsl:template match="test:detect" mode="Mode_B">Mode_B</xsl:template>
<xsl:template match="test:detect" mode="#all"
priority="-1">#not_detected</xsl:template>

Unfotunately, this only works if I know all possible modes in advance.

But I think it is all you have available to you to try. I know of no way to expose the current mode.


. . . . . . . . . . . Ken


-- Vote for your XML training: http://www.CraneSoftwrights.com/s/i/ Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal

Current Thread