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

RE: Error: when distance between section definitions

Subject: RE: Error: when distance between section definitions exceed 3678 (roughly)
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 30 Nov 2005 18:45:52 -0000
error message definitions
Your stylesheet makes one call on xsl:apply-templates for each sibling. When
there are 3678 siblings there are going to be 3678 nested apply-templates
calls. Many processors under such conditions will run out of stack space. 

Your apply-templates calls are the last thing each template does, so they
are amenable to an optimization technique called tail-call-optimization. I
would have expected Saxon 6.5.x to apply this technique, but it's a long
time ago so I can't be sure. Certainly Saxon 8.x should handle it. However,
if you are determined to use MSXML for a problem that it can't handle, then
I can't help you.

The following tests are wrong:

<xsl:if test=".!=contains(.,$SSDD_START)">
> 	<xsl:if test=".=starts-with(.,$REQ_START)

You're comparing a singleton node-set to a boolean, which will always be
true. I don't know whether fixing that will help you.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: geoff hopkins [mailto:geoffhopkins123@xxxxxxxxx] 
> Sent: 30 November 2005 14:43
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Error: when distance between section 
> definitions exceed 3678 (roughly)
> 
> The basic premise of the xsl below is to define
> sections that fall between two marker points
> 'Application Software Requirements and 'Service
> Function Requirements' .  The problem I have is if
> these two marker points have roughly 3678 (or more)
> other nodes between then
> 
> i.e.
> 
> 1. <root>
> 2. <text>'Application Software Requirements</text>
> 3. <text></text>
> ..
> ..
> 3685. <text>Service Function Requirements</text>
> 3686. <text></text>
> </root>
> 
> I get this error message (MSXML4.0)
> Code: 0x80004005
> The XSL Processor stack has overflowed - probable
> cause is infinite template recursion.
> I get this error message (Saxon 6.5.3)
> An exception of type 'java/lang/StackOverflowError'
> was not handled
> 
> Unfortunately I am tied into MSXML for this project,
> any ideas why this is happening? do I need to redefine
> my xsl, if yes will need a good guide as I am quite
> rubbish at it.
> 
> Regards,
> 
> Geoff
> 
> p.s. can't supply the source xml as it contains
> sensitive data.
> 
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="xml" indent="yes"/>
> <xsl:variable name="SSDD_START">Application Software
> Requirements</xsl:variable>
> <xsl:variable name="SSDD_STOP">Service Function
> Requirements</xsl:variable>
> <xsl:variable name="REQ_START">R[</xsl:variable>
> <xsl:variable name="REQ_STOP">]</xsl:variable>
> 
> <xsl:param name="DOC_REF"/>
> 
> <xsl:template match="pdf2xml">
> 	<root>
> 		<artefact doc_ref="{$DOC_REF}">
> 			<xsl:apply-templates select="text[1]"/>
> 		</artefact>
> 	</root>
> </xsl:template>
> 
> <xsl:template match="text">
> <xsl:if test=".!=contains(.,$SSDD_START)">
> 	<xsl:if test=".=starts-with(.,$REQ_START) and
> substring(.,string-length(.),1)=$REQ_STOP">
> 		<instance type_id="1">
> 			<xsl:attribute name="doc">
> 				<xsl:value-of select="$DOC_REF"/>
> 			</xsl:attribute>
> 			<xsl:attribute name="sec">
> 				<xsl:value-of select="."/>
> 			</xsl:attribute>
> 		</instance>
> 	</xsl:if>
> </xsl:if>
> 	<xsl:apply-templates
> select="following-sibling::text[1]"/>
> </xsl:template>
> 
> <xsl:template match="text[contains(.,'Service Function
> Requirements')]">
> 	<xsl:apply-templates
> select="following-sibling::text[contains(.,$SSDD_START)][1]"/>
> </xsl:template>
> 
> <xsl:template match="text[1]">
> 	<xsl:apply-templates
> select="following-sibling::text[contains(.,$SSDD_START)][1]"/>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> 
> 	
> 		
> __________________________________ 
> Yahoo! Mail - PC Magazine Editors' Choice 2005 
> http://mail.yahoo.com

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.