> > parent/child[@name=('availability',
> > 'availability_m')]
> Regarding above: I was curious as to what kind of expression
> is the latter part. I guess it's a list?
> I was trying to check out xslt/xpath specs (1.0), but didn't
> find the definition. It looks obvious, but I wasn't aware of
> existence such a nifty short-cut.
There's a lot new in XSLT 2.0 and XPath 2.0! And quite a lot of it enables
you to express your requirements more directly, which has both usability and
The "," operator is used in general to concatenate sequences. Most commonly
the sequences are single items, so it's just a simple list (1,2,3,5,7,11).
> Actually, I have a follow-up question or two, wrt.
> trying to optimize style sheets a little bit. Being an xslt
> novice, there are a few things that seem like they might
> improve performance, but it may be that smart processors like
> Saxon will already do expression rewriting to obtain same benefits.
> For example, having a test like:
> <xsl:if test="pa[@name='recall_notice_received_date']
> or pa[@name='recall_external_id'] or
> does Saxon already combine such homogenous test into
> equivalent of checking for list membership?
No, I don't think any useful rewriting will be done in this case. Except for
a few special cases, Saxon doesn't recognize common subexpressions (yet!).
You can use the -e option on the command line to see what the execution plan
looks like if you're really interested.
Or should I
> manually rewrite these (style sheet has a few rather long
> conjunction expression lists like
> Or, another long expression of form:
> <xsl:when test="
> /pal/pa[@name='availability' and @mid=$mid] or
> /pal/pa[@name='brand_code' and @mid=$mid] or
> /pal/pa[@name='brand_id' and @mid=$mid] or ....
> does it make sense to rewrite this to take advantage of
> common sub- expression (second check), either by nesting
> <xsl:if> or <xsl:choose>, or by combining expression, using
> @name = ( ... ) and second check.
Yes, it's certainly worth rewriting this as
/pal/pa[@mid=$min and @name=('availability', 'brand_code', 'brand_id')]
(Keep sending these in, by the way, it's always useful to know what
opportunities for rewrites still exist)