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

Param value clobbered when creating variable

           Summary: Param value clobbered when creating variable
           Product: XalanJ2
           Version: 2.3
          Platform: PC
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


In the following stylesheet, the value of the parameter $index.name 
is being clobbered during the creation of the variable $source.index
as shown by the output:

file:///... Line 29; Column 18; (Before) index
file:///... Line 38; Column 18; (After) x

STYLESHEET START-----------------
<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:xalan="http://xml.apache.org/xalan";
  exclude-result-prefixes="xalan" 
  version="1.0">
  <xsl:output method="xml" indent="yes"/>

  <xsl:param name="index.name" select="'index'"/>

  <xsl:variable name="source.index">

    <!-- Sort articles by code -->
    <xsl:variable name="sorted.sources">
      <xsl:for-each select="/qhlp-index/article">
        <xsl:sort select="@code"/>
        <xsl:copy-of select="."/>
      </xsl:for-each>
    </xsl:variable>

    <!-- 
      Get the set of articles with the property that the preceding article
      does not have the same initial. We then use this set to create the
      initial elements which are populated with all articles that begin with
      the same initial letter.

      NOTE this clobbers the variable $index.name
    -->
    <xsl:message>(Before) <xsl:value-of select="$index.name"/></xsl:message>
    <xsl:for-each
      select="xalan:nodeset($sorted.sources)/article[not(substring(@code, 1, 1)
          = substring(preceding::article[position()=1]/@code, 1, 1))]">
      <xsl:variable name="initial" select="substring(@code,1,1)"/>
      <initial letter="{$initial}">
        <xsl:copy-of select="../article[substring(@code,1,1) = $initial]"/>
      </initial>
    </xsl:for-each>
    <xsl:message>(After) <xsl:value-of select="$index.name"/></xsl:message>
  </xsl:variable>
  

  <!-- Main entry point -->
  <xsl:template match="qhlp-index">
    <xsl:apply-templates select="xalan:nodeset($source.index)/initial"/>
  </xsl:template>

  <xsl:template match="initial">
    <xsl:copy-of select="."/>
  </xsl:template>
</xsl:stylesheet>
STYLESHEET END-------------------

SAMPLE INPUT START---------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<qhlp-index>
  <article code="xj2r" text="Xalan-Java 2 represents"/>
  <article code="afr" text="a fundamental redesign"/>
  <article code="oxjtp" text="of Xalan-Java. The primary"/>
  <article code="ootr" text="objective of this redesign"/>
  <article code="iaetum" text="is an easier-to-use, more"/>
  <article code="uam" text="understandable, and more"/>
  <article code="mate" text="modular API that encourages"/>
  <article code="wpii" text="wider participation in its"/>
  <article code="odbt" text="ongoing development by the"/>
  <article code="osxd" text="open-source XML developer"/>
  <article code="catl" text="community, and that lends"/>
  <article code="itst" text="itself to streaming, the"/>
  <article code="pot" text="production of transformation"/>
  <article code="owtii" text="output while the input is"/>
  <article code="sbp" text="still being parsed."/>
</qhlp-index>
SAMPLE INPUT END-----------------

Reply via email to