You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Henry Zongaro <zo...@ca.ibm.com> on 2007/09/05 16:23:52 UTC

Re: Multiple Selections of a Node--Appears to be a Bug

Hi, Garrel.

The problem that you describe looks like its the same as the one described 
in XALANJ-2204.[1]  That bug is fixed in the current source for Xalan-J.

Thanks,

Henry
[1] http://issues.apache.org/jira/browse/XALANJ-2204
------------------------------------------------------------------
Henry Zongaro      XSLT Processors Development
IBM SWS Toronto Lab   T/L 969-6044;  Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com



Kevin Cormier/Toronto/IBM@IBMCA 
2007-08-28 11:00 AM

To
"Renick, Garrel" <ga...@more.net>
cc
xalan-j-users@xml.apache.org
Subject
Re: Multiple Selections of a Node--Appears to be a Bug






Hi Garrel,

I was able to reproduce your problem with Xalan-J 2.7.0, but I was not 
able
to reproduce it using the candidate code for 2.7.1 or the latest
development code.  So it looks like this bug was reported and fixed, 
though
so far I haven't been able to find it on JIRA
(http://issues.apache.org/jira)

Kevin Cormier
Software Developer, XSLT Development
IBM Toronto Lab, D1-435
E-mail:  kcormier@ca.ibm.com


 
             "Renick, Garrel" 
             <ga...@more.net> 
                                                                        To 

             08/27/2007 05:44          <xa...@xml.apache.org> 
             PM                                                         cc 

 
                                                                   Subject 

                                       Multiple Selections of a 
                                       Node--Appears to be a Bug 
 
 
 
 
 
 




I'm seeing different results of a simple transformation using 
xalan-j_2_6_0
(and prior versions) versus xalan-j_2_7_0. This happens on BSD and Windows
implementations. The xalan-j_2_7_0 version results in duplicated output as
described below. I'm using jdk1.5.0_12. Here is a data set and a 
stylesheet
that display the problem:

XML:
<?xml version='1.0'?>
<document>
 <permission>
  <grp gid="101" name="group1"/>
  <grp gid="102" name="group2"/>
 </permission>
</document>

XSLT:
<?xml version="1.0"?>
<xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
  <xsl:output  method="html"/>

  <xsl:variable name="theData" select="/document/permission"/>

  <xsl:template match="/document">
    <xsl:variable name="grpcount"  select="count($theData/grp)"/>
    <xsl:call-template name="makeGroupList">
      <xsl:with-param name="groupSize" select="$grpcount"/>
    </xsl:call-template>
  </xsl:template>

  <xsl:template name="makeGroupList">
    <xsl:param name="groupSize"/>
    <select name="selectName" size="{$groupSize}" multiple="true">
      <xsl:apply-templates select="$theData/grp">
        <xsl:sort select="@name"/>
      </xsl:apply-templates>
    </select>
  </xsl:template>

  <xsl:template match="grp">
    <xsl:variable name="gid" select="./@gid"/>
        <option value="{$gid}"><xsl:value-of select="@name"/></option>
  </xsl:template>
</xsl:stylesheet>

Output xalan-j_2_7_0:
<select multiple="true" size="2" name="selectName">
  <option value="101">group1</option>
  <option value="101">group1</option>
  <option value="102">group2</option>
  <option value="102">group2</option>
</select>

However, the output from j_2_6_0 (and earlier versions) is as expected:

Output xalan-j_2_6_0:
<select multiple="true" size="2" name="selectName">
  <option value="101">group1</option>
  <option value="102">group2</option>
</select>

If I comment out the grpcount variable definition and pass a param with a
literal value in the call to the makeGroupList template, both versions of
xalan produce the same output.

I'd appreciate any insight into why this is happening.

Regards,
Garrel Renick