Subject: Re: [xsl] problem creating containment during XHTML->XML From: "J.Pietschmann" <j3322ptm@xxxxxxxx> Date: Mon, 23 Feb 2004 23:36:39 +0100 |
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>
- <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.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] problem creating containment , Don Stinchfield | Thread | RE: [xsl] problem creating containm, Michael Kay |
RE: [xsl] Re: Re: Network diagram -, Michael Kay | Date | RE: [xsl] problem creating containm, Josh Canfield |
Month |