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

Re: union operator and predicates in XSLT patterns

  • From: Tomos Hillman <tomos.hillman@oup.com>
  • To: xml-dev@lists.xml.org
  • Date: Mon, 24 Jan 2011 20:57:20 +0000

Re: union operator and predicates in XSLT patterns
Thanks all for your replies.

Ken, I suspected I was being a little naughty posting to this list, but enthusiastic responses was not necessarily what I was after (I correctly suspected that people here were more likely to address the question rather than simply suggest work-arounds, which I don't need).

I'll try to be good from now on.

T

On Monday, 24 January 2011 at 6:36PM, Michael Kay wrote:

On 24/01/2011 17:06, HILLMAN, Tomos wrote:
Hi; just a quick query for my own understanding. Apologies if I've gotten the wrong list.

I wanted to use both a union and operator in an XLST template, i.e. match="(div1|div2)[not(@role)]" (simplified).

This is, I think, equivalent in XPath 2.0 as "/*//(div1|div2)[not(@role)]", which I would expect to follow the rule for patterns in XSLT (the node $N matches pattern PAT if $N is a member of expression "root($N)//(PAT)". However, this shows as invalid.

Can someone explain this to me? :)

One of the reasons for the restriction that "|" is allowed only as the
top-level operator in an XSLT pattern is that it affects the algorithm
for computing the default priority of the template rule.

You can write this pattern as

div1[not(@role)] | div2[not(@role)]

or as

*[not(@role)][self::div1 or self::div2]

(In Saxon, the first version will perform better).

Michael Kay
Saxonica

_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
subscribe: xml-dev-subscribe@l...
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.