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

Re: Sibling text nodes

Subject: Re: Sibling text nodes
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 16 Jul 2002 16:54:20 +0100
following sibling
Hi John,

> Given an XML fragment like:
>
> <outer><inner>blah</inner> following text.</outer>
>
> Before I can finish processing the "inner" element, I need to
> examine the next sibling node (following-sibling::*[1]?) to
> determine if it is a text node whose contents begin with a
> non-whitespace character.

You're close. following-sibling::*[1] gets the next sibling *element*.
You want to get the next sibling node:

  following-sibling::node()[1]

then test whether it's a text node:

  following-sibling::node()[1][self::text()]

Having found it, you can then test whether it starts with a whitespace
character:

  contains(' &#x9;&#xA;&#xD',
           substring(following-sibling::node()[1][self::text()], 1, 1))

This test will return true if the next sibling node is a text node
that starts with a whitespace character, and false if there isn't a
following sibling node, it's not a text node, or if it doesn't start
with a whitespace character.
    
Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.