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

Duplicated node is written to outputTarget on xsl:sort with -TS option.

           Summary: Duplicated node is written to outputTarget on xsl:sort
                    with -TS option.
           Product: XalanJ2
           Version: 2.2.x
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Follows occured with Xalan 2.2.D13 and  D14. (I did not check other version.)
Duplicated node is written to outputTarget within the following condition.
- xsl:for-each or xsl:apply-templates with xsl:sort and
- add -TS option on Xalan command line.

I added input XML and XSLT examples on the bottom.

I added some experiment on the following.
- Without -TS option, the above does not happen.
- Without xsl:sort, the above does not happen.
- I tried without -TS option i.e. without PrintTraceListener.class, but
  made test application which use debug interface(implemented TraceListener 
interface).
  And I found the above happens. Following is the test application's summary.
  "In selected(SelectionEvent ev) routine, when I try to list up selected node 
in ev.m_selection,
   I got duplicated node through DTMIterator. Also through NodeSetDTM and 
NodeList and NodeIterator"

[XSLT file   xslt:for-each version]
----- =-8 ---------- =-8 ---------- =-8 ---------- =-8 -----
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0"
  xmlns="http://www.w3.org/TR/REC-html40";>

<xsl:template match="/">
  <xsl:apply-templates />
</xsl:template>

<xsl:template match="info">
  <xsl:for-each select="data">
    <xsl:sort select="age" order="ascending" data-type="number"/>
    <xsl:value-of select="name"/>
  </xsl:for-each>
</xsl:template>

</xsl:stylesheet>
----- =-8 ---------- =-8 ---------- =-8 ---------- =-8 -----


[input XML document]
----- =-8 ---------- =-8 ---------- =-8 ---------- =-8 -----
<?xml version="1.0"?>
<info>
  <data>
    <name gender="man">makino1</name>
    <age>40</age>
  </data>
  <data>
    <name gender="woman">makino2</name>
    <age>35</age>
  </data>
  <data>
    <name gender="woman">makino3</name>
    <age>30</age>
  </data>
</info>
----- =-8 ---------- =-8 ---------- =-8 ---------- =-8 -----


[XSLT file   xslt:apply-templates version]
----- =-8 ---------- =-8 ---------- =-8 ---------- =-8 -----
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0"
  xmlns="http://www.w3.org/TR/REC-html40";>

<xsl:template match="/">
  <xsl:apply-templates />
</xsl:template>

<xsl:template match="info">
  <xsl:apply-templates select="data">
    <xsl:sort select="age" order="ascending"/>
  </xsl:apply-templates>
</xsl:template>

<xsl:template match="data">
  <xsl:value-of select="name"/>
</xsl:template>

</xsl:stylesheet>
----- =-8 ---------- =-8 ---------- =-8 ---------- =-8 -----

Reply via email to