[xsl] Error: when distance between section definitions exceed 3678 (roughly)

Subject: [xsl] Error: when distance between section definitions exceed 3678 (roughly)
From: geoff hopkins <geoffhopkins123@xxxxxxxxx>
Date: Wed, 30 Nov 2005 06:43:22 -0800 (PST)
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