|
[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
|
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

|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
| RSS 2.0 |
|
| Atom 0.3 |
|
|