xsl-list
[Top] [All Lists]

RE: Predicate on root node?

2005-02-24 10:11:30

I want a template that will match the root node if it has a 
particular 
child node, but this

      <xsl:template match="/[some-node]"


Yes, it's an odd omission. As a path expression, you can write (/)[X], but
not /[X] - this is true both in 1.0 and 2.0. XSLT doesn't allow parentheses
within a pattern, so you can't use this construct in a pattern.

However, there's a workaround in 2.0: you can write document-node()[X],
either as an XPath expression or as a pattern.

Michael Kay
http://www.saxonica.com/



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