This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Re:Re:How to robustly handle mulple conditions in xslt format
- To: "Yang" <sfyang at unisvr dot net dot tw>
- Subject: Re: [xsl] Re:Re:How to robustly handle mulple conditions in xslt format
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Fri, 25 May 2001 13:21:51 +0100
- CC: xsl-list at lists dot mulberrytech dot com
- Organization: Jeni Tennison Consulting Ltd
- References: <000b01c0e50e$a52397d0$1601800a@hqlab.unisvr>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Sun-Fu,
> Thanks for nice input of building XML structure to handle multiple
> conditions. It is certainly a good suggestions I can use. But I
> start to worry about the performance problem from using the
> complicated predicates.
Sure, but that's a price that you have to pay for the flexibility of
having dynamically named variables. However, in your example you
*know* what variables you have: $month, $dayID etc.. If you always
want to test those anyway, why don't you just hard code them into the
stylesheet? Why do you need to have dynamically named variables if
you're always using the same variables?
If you want them defined from two string parameters being passed into
the stylesheet, then why not set them up with things like:
<xsl:variable name="month" select="$variables[@name = 'month']" />
<xsl:variable name="dayID" select="$variables[@name = 'dayID']" />
...
Better still, pass in the parameters separately, using the Javascript
to assign values with .addParameter().
I'd only suggest that you use the kind of $variables XML if you can't
predict the names of the variables that you'll need to reference. If
that's the case and you're worried about performance, you could always
use keys to make it a bit more efficient (though it'll make the XSLT
more complicated because you'll need to change context to the
$variables node set to find variable elements with that key value
within that node set - it's like a separate document).
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list