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

libxslt 10124 detects a potential infinite template r

Subject: libxslt 10124 detects a potential infinite template recursion whereas there is not a potential infinite template recursion
From: spam.spam.spam.spam@xxxxxxx
Date: Sat, 19 Feb 2011 17:06:52 +0100 (CET)
 libxslt 10124 detects a potential infinite template  r
Hello,

I have these files :
-example.xsl
-example.xml

If I use:
$ xsltproc --version
Using libxml 20632, libxslt 10117 and libexslt 813
xsltproc was compiled against libxml 20632, libxslt 10124 and libexslt 813
libxslt 10117 was compiled against libxml 20632
libexslt 813 was compiled against libxml 20632

Then I run:
xsltproc --param param "'abc:def:ghi:'" example.xsl example.xml

I get:
<?xml version="1.0"?>
abcdefghi

Which is the expected result... I am happy :-)

Now If I an other libxslt version:
$ xsltproc --version
Using libxml 20632, libxslt 10124 and libexslt 813
xsltproc was compiled against libxml 20632, libxslt 10124 and libexslt 813
libxslt 10124 was compiled against libxml 20632
libexslt 813 was compiled against libxml 20632

Then I run the same command:
xsltproc --param param "'abc:def:ghi:'" example.xsl example.xml

I get:
runtime error: file example.xsl line 12 element choose
xsltApplyXSLTTemplate: A potential infinite template recursion was detected.
You can adjust xsltMaxDepth (--maxdepth) in order to raise the maximum number of nested template calls and variables/params (currently set to 3000).
Templates:
#0 name myrecursivetemplate
#1 name myrecursivetemplate
#2 name myrecursivetemplate
#3 name myrecursivetemplate
#4 name myrecursivetemplate
#5 name myrecursivetemplate
#6 name myrecursivetemplate
#7 name myrecursivetemplate
#8 name myrecursivetemplate
#9 name myrecursivetemplate
#10 name myrecursivetemplate
#11 name myrecursivetemplate
#12 name myrecursivetemplate
#13 name myrecursivetemplate
#14 name myrecursivetemplate
Variables:
no result for example.xml

So the old libxslt version (10117) works better than the new libxslt version (10124) because it detects a potential infinite template recursion only when there is really a potential infinite template recursion.

Can you correct this?

Thank you.

---

$ cat example.xml 
<?xml version="1.0" encoding="UTF-8" ?>
<example>
</example>

$ cat example.xsl 
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
	<xsl:output method="xml" />
	<xsl:param name="param" />
	<xsl:strip-space elements="*" />
	<xsl:template match="/">
		<xsl:call-template name="myrecursivetemplate">
			<xsl:with-param name="param" select="$param" />
		</xsl:call-template>
	</xsl:template>
	<xsl:template name="myrecursivetemplate">
		<xsl:choose>
			<xsl:when test="string-length($param)=0">
				<xsl:value-of select="$param" />
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="substring-before($param, ':')" />
				<xsl:call-template name="myrecursivetemplate">
					<xsl:with-param name="param" select="substring-after($param, ':')" />
				</xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>

$ cat run.sh 
xsltproc --param param "'abc:def:ghi:'" example.xsl example.xml

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.