<xsl:apply-templates select="//blog
[not($AuthorId) or (author_id = $AuthorId)]
[not($CategoryId) or (category_id =
$CategoryId)]
"/>
I guess I'll finally drop in and add another suggestion since
I've been waiting for one of my XSLT students to bring it up
but I don't see any of them doing so.
If you are looking for compactness, I believe the above
expression can be reduced to the following in both XSLT 1.0
and XSLT 2.0:
<xsl:apply-templates select="//blog
[not($AuthorId != author_id)]
[not($CategoryId != $CategoryId)]
"/>
I'm not convinced about this equivalence. If $AuthorId is "Mike", and
author_id is an empty sequence, then
(a) not($AuthorId) or (author_id = $AuthorId) ==> false
(b) not($AuthorId != author_id) ==> true
So if the optimizer does this conversion for you, it's wrong!
But it's probably safe if author_id will always be a singleton node-set.
Regards,
Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay
--~------------------------------------------------------------------
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>
--~--