You could also handle the Text Node in your java code with
TextNode t = node.getFirstChild(); String = t.getNodeValue();
That way if you decide to augment your data, say by adding an attribute or if date opened has child nodes, they will still be accessible. If you call the extension function with the text() operator, you only get the Text node, no options available.
BTW, the use of the // operator should be used with great care. Your performance may quickly go down the drain because it will cause EVERY element in your document to be tested.
Regards John G
Oleg Dulin wrote:
You might want to try //Date_Opened/text(), because what you really want is the node value of the text child of Date_Opened ...
Oleg
Doug Lochart wrote:
I am relatively new to XSLT so bare with me if this is an easy question. I created and I am using a Java Extension that takes a NodeList. The XML Data for the nodes is of this form:
<Date_Opened>2004/07</Date_Opened>
The extension method signature is this:
public String xslGetOldestAndNewestDates(org.w3c.dom.NodeList nodes)
from xsl I call the method like this
...
<xsl:with-param name="data" select="java:xslGetOldestAndNewestDates($xslHelper,//Date_Opened)"/>
Which should select all Date_Opened nodes.
In the body of the extension method I iterate over the nodes. When I call getNodeName() I get the correct name but when I call getNodeValue() I get null. I read somthing about indeterminate node types returning null so I tried casting it to a Text node and a DTMNodeProxy but I still get Null. I had another extension function that takes a list of nodes of which I only use the names to make decisions so I tried doing a getNodeValue() there and that also returned null.
What am I doing wrong?
Thanks in Advance
Douglas Lochart
Now I've gained some understanding
Of the only world that we see.
Things that I once dreamed of
Have become reality.
These walls that still surround me
Still contain the same old me,
Just one more who's searching for
A world that ought to be.
