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

Re: preceding-sibling including previous node

Subject: Re: preceding-sibling including previous node
From: andrew welch <andrew.j.welch@xxxxxxxxx>
Date: Mon, 28 Nov 2005 15:03:44 +0000
previous sibling
On 11/28/05, ADAM PATRICK <adampatrick@xxxxxxxxxxxxxx> wrote:
> xslt 1.0 xpath 1.0
> <xsl:template
> mact="animals[preceding-sibling::animals[contains(.'pig')]]">
> With the above how would you:
> Select all preceding-siblings where node text contains
> pig including the line that contains pig.
> Is there something you can do with position?

You've done it as a match pattern, rather than a select.  That
template will only match an <animals> element provided it has a
preceding-sibling <animals> element whose text value (all descendent
text nodes concatenated together) contains the string 'pig'.

If you want to select all preceding-sibling <animals> elements that
have the string 'pig' somewhere in their string values then you would

<xsl:apply-templates select="preceding-sibling::animals[contains(.,

You then need to only specify "animals" in the template match pattern:

<xsl:template match="animals">

It's difficult to guess your exact issue without seeing more of your
stylesheet - if this isn't what you meant then post a snippet of your
xml and xslt and what the problem is.


Current Thread


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.
First Name
Last Name
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.