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/04/17 06:29:11 UTC

DO NOT REPLY [Bug 8183] New: - xsl:copy-of on variable works only once in named template

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=8183>.
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=8183

xsl:copy-of on variable works only once in named template

           Summary: xsl:copy-of on variable works only once in named
                    template
           Product: XalanJ2
           Version: 2.3
          Platform: PC
        OS/Version: Windows 9x
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Xalan
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: thomaso@best.com


I have a stylesheet with a named template.  Inside that
named template, I have a call to <xsl:copy-of select="$spade"/>
where the variable "spade" is a top-level variable.

The first time this template is called, it generates an appropriate copy,
but all instances afterwords generate empty entries.

Here is a simplified source document:

<article xmlns="http://www.thomaso.com/xmlns/bridge">
<hand sp="KT7432"/>
<hand sp="AJ65"/>
</article>

Here is the stylesheet:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
		xmlns="http://www.w3.org/TR/REC-html40"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:bridge="http://www.thomaso.com/xmlns/bridge">

<xsl:output method="html" version="4.0"/>


<xsl:variable name="spade"><font color="black">&#x2660;</font></xsl:variable>

<!-- this value also fails -->
<!-- <xsl:variable name="spade">
<img width="13" height="11" src="S.gif" alt="S:"/>
</xsl:variable> -->

<!-- this works!     -->
<!-- <xsl:variable name="spade">Spade</xsl:variable> -->

<xsl:template match="bridge:article">
<html>
<head>
<title>Dummy</title>
</head>
<body>
<xsl:for-each select="bridge:hand">
<xsl:call-template name="writehand"/>
</xsl:for-each>
</body>
</html>
</xsl:template>

<!-- The call to copy-of here fails after the first call-->
<xsl:template name="writehand">
<p><xsl:copy-of select="$spade"/><xsl:value-of select="@sp"/></p>
</xsl:template>

</xsl:stylesheet>