[xsl] <br/> to <p> and optimization

Subject: [xsl] <br/> to <p> and optimization
From: Emmanuel Bégué <emmanuel@xxxxxxxxxxxxx>
Date: Wed, 2 Jul 2003 13:02:58 +0200
Hello,

On the archives of this list I have found a solution to the problem
of putting all elements between two <br/> elements into a <p> element:
http://www.biglist.com/lists/xsl-list/archives/200101/msg00865.html

However, this process takes a very very long time for "big" files
(over 100k) which have lots of brs (up to two minutes), and I am looking
for a way to optimize it.

In fact my problem is I'm not sure I correctly understand the following
line:
	<xsl:variable name="content"
		select="preceding-sibling::node()
			[not($br-before) or
 			generate-id(preceding-sibling::br[1]) =
			generate-id($br-before)]" />

	$br-before is the preceding <br/>:
		<xsl:variable name="br-before"
			select="preceding-sibling::br[1]" />

So, for setting $content, do we mean that we test _all_ nodes before
the current <br/>, and for each of them we test that they are not
themselves the preceding <br/> (not($br-before)) and that they are
actually after the same <br/> than the one located by $br-before?

In that case obviously we test the same nodes many times: for every
new <br/>, we want to add nodes that are before the current <br/> and
after the preceding one, but we test again the nodes that are before
the last <br/> up to the start of the containing element. Therefore
what we need is a way to "stop" the selection once the current node
that is being tested is in fact $br-before?

Is this correct?

Regards,
Emmanuel Bégué



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread