I am creating a custom XPath function in Java that modifies the text-nodes in a node-set. I need to pass in a node-set, have the code loop through every node and return a node-set. I have seen many examples of custom XPath functions that modify strings, but none that take in a node set and return a node set successfully. I also don't know how to map the returning node-set.
Take this source XML for example.
<Library>
<Bookshelf>
<Book>alice in wonderland</Book>
<Book>the giving tree</Book>
<Author>shel silverstein</Author>
</Bookshelf>
</Library>
Then I want this to be my target XML. I chose to capitalize the first letter of each word, but this is just an example. Don't worry about the text modification part, I got that.
<Library>
<Bookshelf>
<Book>Alice In Wonderland</Book>
<Book>The Giving Tree</Book>
<Author>Shel Silverstein</Author>
</Bookshelf>
</Library>
The biggest thing here is that I want to implement this as a custom XPath function using Java so that it can be drag-and-dropped in Designer mode. And I am using a File Adapter on each side of this transformation, so the structure of all the nodes is already given and I have to make my results fit in.