Subject: RE: Predicate on root node?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 24 Feb 2005 17:11:30 -0000
|
> 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/
|