[ https://issues.apache.org/jira/browse/XALANJ-2424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562462#action_12562462 ]
Илья Казначеев commented on XALANJ-2424: ---------------------------------------- BasisLibrary::nodeList2Iterator does seriously 'not smart' thing: It attempts to appendChild() an attribute node into DocumentElement. That's an obvious bag, but I'll now go farther and try to understand why nodeList2Iterator is called in the first place: simply listing elements don't cause that. > 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.1, 2.7 > Environment: Linux, Sun java 1.6 > Reporter: Илья Казначеев > Attachments: Process.jad, xml1.xml, xsl1.xsl > > > 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: > <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> > With xml > <source> > <element attr="val1" name="foobar" /> > <element attr="val2" name="bar" /> > <element attr="val2" name="baz" /> > <element attr="val3" name="baz" /> > </source> > 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: > // 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)> > P.S. If said variable is located in prologue (not inside any xsl:template) > the bug persists. -- 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]