You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/03/01 12:26:00 UTC
DO NOT REPLY [Bug 6782] New: -
xalan output content lost when templates called include copy-of
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6782>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6782
xalan output content lost when templates called include copy-of
Summary: xalan output content lost when templates called include
copy-of
Product: XalanJ2
Version: 2.0.0
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Major
Priority: Other
Component: org.apache.xalan
AssignedTo: xalan-dev@xml.apache.org
ReportedBy: mick.woolley@cmgplc.com
Xalan transform fails to produce its output when the marked template 'breakMe'
is included. This all works as expected in 2.2.D14, but fails in 2.3. Also, the
problem seems to lie in having several templates using copy-of. In trying to
reproduce a simple test case, I also had out of memory and null pointer
exceptions, where uncontrolled recursion appears to have occured.
<?xml version="1.0" ?>
<screen>
<list>
<item code="1"></item>
<item code="2"></item>
<item code="3"></item>
</list>
</screen>
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
<xsl:output encoding="iso-8859-1"/>
<!--
main template to produce screen
-->
<xsl:template match="screen">
<xsl:call-template name="template1" />
</xsl:template>
<xsl:template name="template1">
<xsl:call-template name="copier">
<xsl:with-param name="content">
<!-- comment this out and the display works when
breakMe template is still there -->
<xsl:call-template name="template2"/>
<xsl:call-template name="listTemplate"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!--
NB Can remove the nested call-template and also works when breakMe
template present ...
-->
<xsl:template name="template2">
<xsl:call-template name="copier">
<xsl:with-param name="content">
<xsl:call-template name="template3"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="template3">
template3
</xsl:template>
<!--
generate list.
-->
<xsl:template name="listTemplate">
*** FULL LIST ***
<xsl:call-template name="listItems"/>
</xsl:template>
<!--
NB This is where the program can all go wrong
-->
<xsl:template name="listItems">
<xsl:for-each select="/screen/list/item">
hi
<!--
put this template in, content (hi, lo, and FULL LIST)
is lost ...
comment it out and it works
-->
<xsl:call-template name="breakMe"/>
bye
</xsl:for-each>
</xsl:template>
<xsl:template name="breakMe">
broken
</xsl:template>
<xsl:template name="copier">
<xsl:param name="content"></xsl:param>
<xsl:copy-of select="$content"/>
</xsl:template>
</xsl:stylesheet>