[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Varied Results with Different Versions of Xalan, But H

Subject: Varied Results with Different Versions of Xalan, But How?
From: "Renick, Garrel" <garrel@xxxxxxxx>
Date: Thu, 23 Aug 2007 11:32:28 -0500
 Varied Results with Different Versions of Xalan
I have an odd problem that seems unexplainable. I'm seeing different
results of a simple transformation using xalan-j_2_6_0 (and prior
versions) versus xalan-j_2_7_0. The xalan-j_2_7_0 version results in
duplicated output. I'm using jdk1.5.0_12. Here are examples:

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" omit-xml-declaration="yes"/>

  <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 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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.