set:distinct() over attribute list breaks XSLTC throwing HIERARCHY_REQUEST_ERR
------------------------------------------------------------------------------

                 Key: XALANJ-2424
                 URL: https://issues.apache.org/jira/browse/XALANJ-2424
             Project: XalanJ2
          Issue Type: Bug
          Components: XSLTC
    Affects Versions: 2.7, 2.7.1
         Environment: Linux, Sun java 1.6
            Reporter: Илья Казначеев


If you do set:distinct over attribute list, XSLTC-compiled translet throws 
HIERARCHY_REQUEST_ERR exception.
Exception is localised to point where set:distinct is called, even if it is 
assigned into a variable.

Test case:
<code><pre><tt><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns:set="http://exslt.org/sets"; version="1.0">
        <xsl:output method="html" />
        <xsl:template match="/">
                <xsl:variable name="attrs" 
select="set:distinct(source/element/@attr)" />
  <html><body>
                <xsl:for-each select="$attrs">
                        <xsl:value-of select="." />
                </xsl:for-each>
                </body></html>
        </xsl:template>
</xsl:stylesheet></tt></pre></code>

With xml
<code><pre><tt><source>
        <element attr="val1" name="foobar" />
        <element attr="val2" name="bar" />
        <element attr="val2" name="baz" />
        <element attr="val3" name="baz" />
</source></tt></pre></code>

that will cause an Exception to be thrown when variable is assigned.

My unedicated guess is that it tries to apply-templates over selected nodes 
into document in place where set:distinct is computed. This happens, as I see 
for different partially-serialized document, before variable's enclosing 
element is closed. I've disassembled the stylesheet but didn't understand much 
from there, it goes like this:
<code><pre><tt>    //   30   66:invokeinterface #110 <Method 
org.w3c.dom.NodeList DOM.makeNodeList(DTMAxisIterator)>
    //   31   71:invokestatic    #116 <Method org.w3c.dom.NodeList 
ExsltSets.distinct(org.w3c.dom.NodeList)>
    //   32   74:aload_0
    //   33   75:aload_1
    //   34   76:invokestatic    #122 <Method DTMAxisIterator 
BasisLibrary.nodeList2Iterator(org.w3c.dom.NodeList, 
org.apache.xalan.xsltc.Translet, DOM)>
    //   35   79:new             #126 <Class CachedNodeListIterator>
    //   36   82:dup_x1
    //   37   83:swap
    //   38   84:invokespecial   #127 <Method void 
CachedNodeListIterator(DTMAxisIterator)>
    //   39   87:iload           4
    //   40   89:invokeinterface #41  <Method DTMAxisIterator 
DTMAxisIterator.setStartNode(int)>
    //   41   94:astore          9
    //   42   96:aload_3
    //   43   97:ldc1            #129 <String "html">
    //   44   99:dup2
    //   45  100:invokeinterface #14  <Method void 
SerializationHandler.startElement(String)></tt></pre></code>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to