This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Path expressions became a lot more flexible in XPath 2.0, but little of this flexibility was passed on to XSLT patterns. Some patterns which we don't currently allow, but which could be very useful: (chapter//footnote)[1] book/(chapter|appendix) node() except element() We should review the subset of XPath syntax that is allowed in XSLT patterns and only prohibit constructs where there is a good reason.
Some specific suggestions for enhancements: (a) allow a variable reference at the start of the pattern, for example $lookup//data. Can be written currently as data[ancestor::node() intersect $lookup], but that's pretty cumbersome. Useful to specify that a template rule is applicable only to one specific document. (b) this also allows match="$nodeset" where $nodeset is a global variable. The pattern then matches all nodes in this nodeset. Useful in cases where it is easier or more efficient to select some set of nodes (often those to be treated as exceptions) in a global variable. I've seen this in WordXML documents: "ignore the first w:d element after any w:img element that has a w:text descendant", etc. (c) allow the first step to be a call on doc() or document(). Achieves the same thing but without the need for a global variable. A more radical idea is to allow the match pattern of an xsl:template to reference the template parameters. So if the xsl:apply-templates specifies <xsl:with-param name="color" select="'red'"/> then a template with match="*[$color='blue']" will not be selected.
*** Bug 5840 has been marked as a duplicate of this bug. ***
Another one that comes up (see Christian Roth on xsl-list today) is to match the first descendant of something, e.g. chapter/descendant::para[1] or (chapter//para)[1]. Neither syntax is currently allowed.
A proposal for patterns to match atomic values is at http://lists.w3.org/Archives/Member/w3c-xsl-wg/2009Apr/0070.html (member-only link) It does not address all the requirements raised here.
This is done in the current (internal) working draft