Hi.

When accessing child nodes in a NodeList passed to an extension
function an DTMDOMException is thrown.

[foo.xsl]------------------------------------------------------------------------
   <xsl:template match="map:matcher">
      <xsl:variable name="config"><xsl:copy-of select="."/></xsl:variable>
      <xsl:value-of select="foo:dumpConfig($config)"/>
   </xsl:match>
[/foo.xsl]------------------------------------------------------------------------


[foo.xml]------------------------------------------------------------------------
   <map:matcher name="referer-match" 
src="org.apache.cocoon.matching.WildcardHeaderMatcherFactory">
      <parameter-name>referer</parameter-name>
   </map:matcher>
[/foo.xml]------------------------------------------------------------------------


[foo.java]------------------------------------------------------------------------

    //...

    public String dumpConfig(NodeList conf)
    { // dump config
        if (conf != null) {
            for (int i=0; i<conf.getLength(); i++) {
                Node node = conf.item(i);
                if (node!=null) {
                    if (node.hasChildNodes()){
                        getLogger().debug("<"+node.getNodeName()+">");
                        try {
                            this.dumpConfig(node.getChildNodes());
                        } catch (Exception e) {
                            getLogger().debug(e.toString()+e.getMessage());
                        }
                        getLogger().debug("</>");
                    } else {
                        getLogger().debug("<"+node.getNodeName()+"/>");
                    }
                }
            }
        }
        return "done";
    }

    //...

[/foo.java]------------------------------------------------------------------------
 
Debug output for D8:

 <#document>
 org.apache.xml.dtm.DTMDOMException:
 </>
 <map:matcher>
 org.apache.xml.dtm.DTMDOMException:
 </>
 <#text/>
 <parameter-name>
 org.apache.xml.dtm.DTMDOMException:
 </>
 <#text/>
 <#text/>

Using D10 prints:

 <#document>
 org.apache.xml.dtm.DTMDOMException:
 </>

>From that it appears that D8 flattens the structure and D10
doesn't. It looks more reasonable to keep the tree structure here. But
why does getChildNodes() throw an exception and how could I make this
work again?

        Chris.

PS: I have posted a similar question on sep-14 but haven't received
    any reply, so I have cleaned it up a bit and made this repost.

-- 
C h r i s t i a n       H a u l
[EMAIL PROTECTED]
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

Reply via email to