Shruti --
The problem is in your XPath expression. You ask for all employee nodes
that contain any data. The part in [] is called a predicate and simply
acts as a condition for which nodes in the XPath should be returned. It
does not modify any of those nodes.
I'm not sure what you're trying to accomplish here because I haven't
seen your input XML or your expected output XML. If you need help
formulating this, your best bet is to ask on the Mulberry list since
this is a straight XML (ie not Xalan-specific) question.
Gary
> shruti wrote:
>
> hello,
>
>
> i am using xalan's extension function tokenize as -
>
> xpath =//employee[tokenize(./,",")]
> XObject ob = XPathAPI.eval(doc,xpath);
> NodeSet ns = ob.mutableNodeset();
> for (int i =0;i<ns.getLength();i++)
> {
> Node n =ns.elementAt(i);
> serializer.transform(new DOMSource(n), new
> StreamResult(System.out));
> }
>
>
> The output i get is the employee nodes as in the input employee.xml.
> The strings did not get seperate on the basis of tokens.
>
> But in the tokenize function in org/apache/xalan/lib/Extensions.java
> ,the resultset formed does contain seperate strings ie proper tokens.
> I am not able to understand as to how then the result is not correct .
> what else do i need to do ?
>
> Input - emplooyee.xml
> --------------------------
> <?xml version="1.0"?>
> <employees xmlns:xalan="http://xml.apache.org/xalan" >
> <employee>Herbert,Johnny,09/01/1998,95000</employee>
> <employee>Hill,Graham,08/20/2000,89000</employee>
> </employees>
>
>
>
> thanx
> shruti