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

n squared behavior with XT for 'preceding' tests?

Subject: n squared behavior with XT for 'preceding' tests?
From: "Wilson, James.W" <James.W.Wilson@xxxxxxxxxxxxx>
Date: Wed, 21 Jul 1999 10:38:20 -0500
n squared
hi all, we have what is probably a pretty common problem: we have a series
of elements in our input which may repeat a heading, or may be different
than the preceding instance, like so...

	<hd>some heading</hd>
	...
	<hd>some heading</hd>
	...
	<hd>some OTHER heading</hd>
	...

we are checking for the 'change points' like this:

<xsl:template match="HD">	
	<!-- Check to see if the text of the HD matches
		the previous HD's text -->
	<xsl:choose>
	<xsl:when 
	
test="not(text()=from-preceding-siblings(HD[position()=1])/text())">
		<NEWDOC><xsl:copy>
			<xsl:apply-templates/>	  			
			<!-- Output the tag's attributes 
				and its contents -->
		</xsl:copy></NEWDOC>
	</xsl:when>
	<xsl:otherwise>	
		<xsl:copy><xsl:apply-templates/></xsl:copy>
	</xsl:otherwise>	
	</xsl:choose>			
</xsl:template>

now, this works fine (with XT) for small documents, but what we find is
that, as documents get larger, this template works more and more slowly, in
proportion to how far we've progressed through the document. Since our input
file is pretty large (10 megs) this n squared behavior eventually brings the
process to its knees. We could split up the input, but of course would like
to do it all in XSL if there's a Right Way To Do It.

Any ideas from the gurus?

James Wilson


 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.