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

RE: Wrap HTML headings and following siblings in <sec

Subject: RE: Wrap HTML headings and following siblings in <section/>
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 27 Mar 2010 11:13:25 -0000
RE:  Wrap HTML headings and following siblings in  <sec
> Currently processors choke on the XPath,
> 
> (html:h1|html:h2|html:h3|html:h4|html:h5|html:h6)/following-si
bling::node()

That's a legal XPath 2.0 expression, but it's not legal in 1.0. You have to
write

*[self::h1|self::h2|...]/following-sibling::node()

Though it's probably more efficient to do

*[preceding-sibling::*[self::h1|self::h2|self::h3...]]

Looking at your code, you're trying to use this as an XSLT pattern rather
than as an XPath expression. For a pattern, you need to use this last form
whether you're in 1.0 or 2.0.

Overall, I think this kind of problem is much better tackled using sibling
recursion, where you apply-templates to the first sibling, it does
apply-templates to the next sibling, and so on. Or in 2.0, you can use
<xsl:for-each-group group-starting-with="h1"/>.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 

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.