[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: RE: Restrictions on XPath expressions in <xsl:key>
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 19 Dec 2007 22:15:03 -0000
RE:  Restrictions on XPath expressions in <xsl:key>
> >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/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.