xsl-list
[Top] [All Lists]

RE: [xsl] Restrictions on XPath expressions in <xsl:key>

2007-12-19 15:15:44
Does someone know a reason why this won't compile:

<xsl:key name="templates"
match="/onm:NetworkModel/onm:Graph/(onm:Nodes|onm:Links)/(onm
:Link|onm:
N ode)/onm:Templates/onm:Template" use="@Name" />

Because match= attributes are restricted to be XPath 
patterns, not all XPath expressions.

...but this will:

<xsl:template match="onm:Graph">
    <xsl:copy>
        <xsl:if

test="(onm:Nodes/onm:Node|onm:Links/onm:Link)/onm:Attributes/onm:Attribute"


Because test= is not restricted to only being a pattern.


And even if it weren't a distinction between patterns and expressions, in an
XPath 1.0 expression (which I suspect you are using) a union expression can
be used on the lhs of "/" but not on the rhs of "/".

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>