xsl-list
[Top] [All Lists]

Re: [xsl] use-when

2010-12-16 16:23:55
On 12/10/2010 01:55 AM, G. Ken Holman wrote:
At 2010-12-10 01:43 +0200, Andriy Gerasika wrote:
I cannot figure out how to use use-when attribute, beyond standard
"system-property('file-separator')" example.

That is the only context of using it, as those are the only properties
defined when the use-when= attributes are evaluated.

Have you yet tried using modes for your problem?


Yes, I use modes extensively
http://www.gerixsoft.com/blog/xslt/pipeline
http://www.gerixsoft.com/blog/xslt/include-mode-new

but what I need, is to separate static portion of xpath to use-when, both for speed and readability purposes, conditions can be quite complex: <xsl:template match="some-xpath1" use-when="$first-config-option=('A','B') or $another-config-option='C'">

where config options are set on TransformerFactory level

any ideas?

<xsl:choose>
<xsl:when test="$file-set='A'">
<xsl:apply-templates mode="file-set-A"/>
</xsl:when>
<xsl:when test="$file-set='B'">
<xsl:apply-templates mode="file-set-B"/>
</xsl:when>
<xsl:when test="$file-set='C'">
<xsl:apply-templates mode="file-set-C"/>
</xsl:when>
</xsl:choose>

...

<xsl:template match="some-xpath1" mode="file-set-A">
<xsl:template match="some-xpath2" mode="file-set-B">
<xsl:template match="some-xpath3" mode="file-set-C">


--~------------------------------------------------------------------
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>