Re: [xsl] name of the current mode

Subject: Re: [xsl] name of the current mode
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sat, 14 Nov 2009 18:32:08 -0800
> Unfotunately, this only works if I know all possible modes in advance.

You can write a generic transformation, that, given a specific
main/primary stylesheet module, traverses the graph of
included/imported stylesheet modules and collects all modes.

Then use this result to (again programmatically) generate all the
templates, needed to determine the current mode.

All the described processing will not require any manual activity.



--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play




On Sat, Nov 14, 2009 at 11:25 AM, Stefan Krause <stf@xxxxxxxx> wrote:
> Hello,
>
> 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">
> B  B  B  B <xsl:variable name="temp_element" as="element()">
> B  B  B  B  B  B  B  B <test:detect/>
> B  B  B  B </xsl:variable>
> B  B  B  B <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.
>
> Best regards,
>
> Stefan

Current Thread