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/11/04 19:58:06 UTC

DO NOT REPLY [Bug 14236] New: - EXSLT function changes variables

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

EXSLT function changes variables

           Summary: EXSLT function changes variables
           Product: XalanJ2
           Version: 2.4Dx
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: org.apache.xalan.lib
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: foxyshadis@hotmail.com


Xalan 2.4.1. A variable $fname is bound prior to several function calls, after
which it is changed. I seriously doubt this is expected behavior, unless I'm
screwing up the function somehow. My guess is that the variable stack is somehow
being messed with, but I'm not a source-trawler so I can't tell. Any ideas?

Style sheet:

<xsl:variable name="source" select="'music'"/>

<xsl:template match="/">
<xsl:for-each select="/list/entry">
<xsl:variable name="file" select="file"/>
<xsl:variable name="fname" select="name"/>

<li><a href="{$source}.{$file}.html"><xsl:value-of select="$fname"/></a></li>
<xsl:variable name="prime1" select="foxy:getvar('prime')"/>
<li><a href="{$source}.{$file}.html"><xsl:value-of select="$fname"/></a></li>
<xsl:variable name="in1" select="foxy:getvar('in')"/>
<li><a href="{$source}.{$file}.html"><xsl:value-of select="$fname"/></a></li>
<xsl:variable name="sort" select="foxy:getvar('sort')"/>
<li><a href="{$source}.{$file}.html"><xsl:value-of select="$fname"/></a></li>
<xsl:variable name="sort2" select="foxy:getvar('sort2')"/>
<li><a href="{$source}.{$file}.html"><xsl:value-of select="$fname"/></a></li>
<xsl:variable name="name" select="foxy:getvar('name')"/>
<li><a href="{$source}.{$file}.html"><xsl:value-of select="$fname"/></a></li>
<xsl:variable name="display_each" select="foxy:getvar('display_each')"/>
<li><a href="{$source}.{$file}.html"><xsl:value-of select="$fname"/></a></li>
<xsl:variable name="comp1" select="foxy:getvar('comp')"/>
<li><a href="{$source}.{$file}.html"><xsl:value-of select="$fname"/></a></li>

</xsl:template>

<func:function name="foxy:getvar">
<xsl:param name="var"/>
<xsl:variable name="param">
<xsl:choose><xsl:when test="param[@name=$var]">
<xsl:value-of select="param[@name=$var]/@select[1]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="../default/param[@name=$var]/@select[1]"/>
</xsl:otherwise></xsl:choose>
</xsl:variable>
<func:result select="$param"/>
</func:function>

Input:

<default>
 <param name="prime" select="$categories"/>
 <param name="comp"  select="$categories/album"/>
 <param name="in"    select=".."/>
 <param name="sort"  select="%@sort"/>
 <param name="sort2" select="%@sort"/>
 <param name="name"  select="@xfid"/>
 <param name="display_each" select="1"/>
</default>
<entry>
 <file>cat</file>
 <name>Genre</name>
 <param name="sort2" select="title"/>
</entry>

Output: (all should be the same)

<li><a href="foxmusic.cat.html">Genre</a></li>
<li><a href="foxmusic.prime.html">$categories</a></li>
<li><a href="foxmusic.in.html">..</a></li>
<li><a href="foxmusic.sort.html">%@sort</a></li>
<li><a href="foxmusic.sort2.html">title</a></li>
<li><a href="foxmusic.name.html">@xfid</a></li>
<li><a href="foxmusic.display_each.html">1</a></li>
<li><a href="foxmusic.comp.html">$categories/album</a></li>