xsl-list
[Top] [All Lists]

Re: [xsl] name of the current mode

2009-11-14 21:32:39
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(_at_)snafu(_dot_)de> 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">
       <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.

Best regards,

Stefan


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>