[xsl] LocPathIterator to DOM Element

Subject: [xsl] LocPathIterator to DOM Element
From: José Manuel Beas <jbeas@xxxxxxxxxxx>
Date: Wed, 23 May 2001 09:21:04 +0200
Hello, everyone! Back to the list.

I've written an xslt that stores Nodesets in a Hashtable like follows:
-------------
<xsl:stylesheet xmlns:ht="/java.util.Hashtable">
    <xsl:param name="table"/>
    <xsl:template match="domain">
        <xsl:for-each select="entity">
            <xsl:variable name="name" select="concat('',@name)"/>
            <xsl:variable name="entityNode" select="."/>
            <xsl:variable name="aux"
select="ht:put($table,$name,$entityNode)"/>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>
-------------

In my application I have the method:
----------
public Element getDefinition ( String name ) {
    LocPathIterator lpi = (LocPathIterator) _tableOfEntities.get(name);
    Node n = lpi.nextNode();
    return (Element)n;
}
--------

And this method is used like follows:
-----------
Element entity = this.getDefinition(name);
NodeList nl = ((Node)entity).getChildNodes();
-----------

But the execution stops with the following error:
DOM ERROR! class: org.apache.xalan.stree.ElementImpl

I'm using LotusXSL 2.0 with VisualAge3.5 and found that the error arrises
when "getChildNodes()" is called because "entity" is not really an "Element"
or a "Node" (which both are interfaces for
org.apache.xalan.stree.ElementImpl"). But I cannot understand the "why" of
this error. Any ideas?

Thanks and Best Regards,
José Manuel Beas

E-business Consultant
SGO Software S.A
Tlf. +34 93 4127707
www.sgosoft.com




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread