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

RE: formatting for breaking paragraph-xpath question

Subject: RE: formatting for breaking paragraph-xpath question
From: Ed Blachman <EdB@xxxxxxxxxxx>
Date: Mon, 24 Sep 2001 13:19:59 -0400
paragraph with question
> If a paragraph contains a pgbreak, I want the first half of the paragraph
> to have an indent, but the part after the pgbreak should not becasue it
> isn't the beginning of the paragraph, just the continuation. (there may be
> other tags, not just text before the <pgbreak/>)
> 
> How do I grab everything before the <pgbreak/> as one block and after the
> <pgbreak/> as a separate block?
> 
> I thought this xpath would work, but it doesn't.
> p[child::pgbreak]/node()[preceding::pgbreak]
> It grabs all nodes within the paragraph, not sure why.
> 
> Any ideas? Is there another way to do this (without revising the XML :-)?

How about
   p[pgbreak]/node()[following-sibling::pgbreak]
for the before nodes, and
   p[pgbreak]/node()[preceding-sibling::pgbreak]
for the after nodes?

preceding-sibling::pgbreak restricts the search for the pgbreak to one
particular p. preceding::pgbreak doesn't restrict the search that way; as a
result, in a structure like this --
<p>Hello<pgbreak/>Goodbye</p>
<p>Thanks<pgbreak/>You're welcome</p>
-- all children of the second p show up as having a preceding::pgbreak, even
though only (in that p) the text node containing "You're welcome" has a
preceding-sibling::pgbreak.

(Clearly this won't work if paragraphs contain multiple pgbreaks -- in that
case, nodes between the first and the last pgbreaks would be found in both
sets. It also won't work if pgbreaks can be lower-level descendants of
paragraphs, rather than just children.)

hth...

-- ed

 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.