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

Re: Pattern notation for preceding-sibling

Subject: Re: Pattern notation for preceding-sibling
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 11 Aug 2014 11:31:45 -0000
Re:  Pattern notation for preceding-sibling
I would write

/foo/E/preceding-sibling::*[self::A | self::N]

If A and N have something in common that leads to this kind of expression
being meaningful, then in a schema-aware world it's quite likely that you can
make them members of the same substitution group G, in which case you can
write

/foo/E/preceding-sibling::schema-element(G)

And another possibility is

/foo/E/preceding-sibling::*[not(self::B)]

Michael Kay
Saxonica
mike@xxxxxxxxxxxx
+44 (0) 118 946 5893




On 11 Aug 2014, at 10:49, Heiko Niemann kontakt@xxxxxxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Hi,
>
> a rather basic question, but I was not able to find samples/answers for it
> yet.
>
> Elements A,B,B,N,E,B,C are contained in element foo.
>
> /foo/E/preceding-sibling::* will return A,B,B,N;
>
> /foo/E/preceding-sibling::N will return N;  - easy -
>
>
> Now I want A,N to be returned, so my first guess is, that this might work:
>
> /foo/E/preceding-sibling::(A,N)
>
> But it does not, so I either have to write
>
> /foo/E/(preceding-sibling::A, preceding-sibling::N) or
>
> /foo/E/*[name() = ('A','N')]
>
>
> So, is there a (short) notation that I missed so far, that does what I
> expected /foo/E/preceding-sibling::(A,N) to do?
>
>
> Regards,
> Heiko

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.