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

Re: problem creating containment during XHTML->XML

Subject: Re: problem creating containment during XHTML->XML
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Mon, 23 Feb 2004 23:36:39 +0100
Re:  problem creating containment during XHTML->XML
Don Stinchfield wrote:
I'm in the process of breaking up an XHTML file into multiple XML files.
...
  <heading level="h1"><a name="content" id="content"></a>Overview</heading>
    <p>On February 20, 1865</p>
...
  <heading level="h3"><a name="mission" id="mission"></a>Mission</heading>
I'm cleaning up a bit and would like to add structure as follows...

  <section>
    <heading level="h1">Overview</heading>
      <p>On February 20, 1865</p>
...
  </section>
  <section>
    <heading level="h3"></a>Mission</heading>

A kind of grouping problem.


- <xsl:template match="x:heading">
- <section>
- <title>
<xsl:value-of select="." /> </title>
<xsl:apply-templates select="following-sibling::*" />
...
The above puts me in an infinite loop.

Not necessarily infinite but certainly O(n^2) behaviour. Think about it. Instead of *all* following siblings of a heading, you want to select only siblings whose first preceding header sibling is the matched header. Or in XPath: select="following-sibling::*[ generate-id(preceding-sibling::x:header[1])= generate-id(current())]" There are several other possiblities to express this, some of which may have a better performance.

J.Pietschmann

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.