cannot find the namespace declarations from an extension function

Adrian Herscu <[email protected]>
Newsgroups gmane.text.xml.xalan.java.user
Message-ID <[email protected]>
Hi all,

I am using Xalan 2.7.0. I am writing a large XSL application which 
processes WSDL files. Because of the nature of WSDL files, this 
processing requires a complex loop declaration just to traverse a 
reference. Right now, the code looks like this:

<!-- key for looking up the wsdl:binding -->
<variable name="binding-key">
   <apply-templates select="." mode="binding-key" />
</variable>

<for-each select="key('binding',$binding-key)">
...
</for-each>

Imagine few nested loops like the one above...
Hence, I want to simplify the code to look like:

<for-each select="myxslutils:ref(/wsdl:definitions/wsdl:binding,
   'name', @binding, /wsdl:definitions/@targetNamespace)">
...
</for-each>

Somewhere in my extension function I need to extract the namespace URI 
of a given prefix. I tried the node.lookupNamespaceURI(prefix) method 
but it returns with a null value :( Tried it on the root element also 
and got the same result. Tried to enumerate the attributes of the root 
element and the namespace attributes are not returned -- any clues?

The WSDL document is read using this method:

transformer.transform(new StreamSource(reader),
             new StreamResult(writer));

where reader is a java.io.FileReader.

It seems like the namespace declarations are missing from the parse 
tree. OTH, the transformations depend on these namespace declarations 
and they work as expected.

Please help,
Adrian.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.