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 2004/04/27 13:26:10 UTC

DO NOT REPLY [Bug 28622] New: - Sorting fails, if id(...) is used">

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28622>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28622

Sorting fails, if id(...) is used">

           Summary: Sorting fails, if id(...) is used">
           Product: XalanJ2
           Version: 2.5
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Xalan
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: oberdiek@uni-freiburg.de


Sorting fails, if "id(...)" is used:

test.xml:

<?xml version="1.0" standalone="yes"?>
<!DOCTYPE test [
  <!ELEMENT test (a+,b)>
  <!ELEMENT a EMPTY>
  <!ELEMENT b EMPTY>
  <!ATTLIST a id   ID     #REQUIRED
              name CDATA  #REQUIRED>
  <!ATTLIST b refs IDREFS #REQUIRED>
]>
<test>
  <a id="a" name="foo"/>
  <a id="b" name="bar"/>
  <b refs="a b"/>
</test>

test.xsl:<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
  xmlns:exslt="http://exslt.org/common"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output method="text"/>

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

  <xsl:template match="b">
    <xsl:text>Wrong sorting order:&#10;</xsl:text>
    <xsl:for-each select="id(@refs)">
      <xsl:sort select="@name"/>
      <xsl:value-of select="concat('* ', @name, '&#10;')"/>
    </xsl:for-each>

    <xsl:text>Correct result only, if id() is wrapped </xsl:text>
    <xsl:text>into node-set():&#10;</xsl:text>
    <xsl:for-each select="exslt:node-set(id(@refs))">
      <xsl:sort select="@name"/>
      <xsl:value-of select="concat('* ', @name, '&#10;')"/>
    </xsl:for-each>

    <xsl:text>Also apply-templates fails:&#10;</xsl:text>
    <xsl:apply-templates select="id(@refs)">
      <xsl:sort select="@name"/>
    </xsl:apply-templates>
  </xsl:template>

  <xsl:template match="a">
    <xsl:value-of select="concat('* ', @name, '&#10;')"/>
  </xsl:template>

</xsl:stylesheet>

Tested versions: 2.3.1, 2.5.0, 2.5.2, 2.6.0

Yours sincerely
  Heiko <ob...@uni-freiburg.de>

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org