File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Generate XML / DOM using XSL and Xpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Generate XML / DOM using XSL and Xpath" Watch "Generate XML / DOM using XSL and Xpath" New topic
Author

Generate XML / DOM using XSL and Xpath

sonali ag
Greenhorn

Joined: Oct 08, 2009
Posts: 5
Hi,

I want to generate XML based on XSL and Xpaths.
The XSL file may look like:
<rootNode namespace...>
<mainNode>
<element1>
</element2>
</optionalElement>
</element1>
</element3>
</elemet4>
---
</mainNode>
</rootNode>

And I have map of Xpaths (like "/rootNode/mainNode/element3" ) and corresponding text values .
So how to use XSL and xpath to generate XML / DOM with nodes having run time text values.
Also the final xml document may contain multiple 'mainNode' s.

Thank you.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12781
    
    5
We have had several questions like this recently!

What is generating this strange requirement? Is this some class homework.

Since you don't have a DOM, any xpath style statements are just a bunch of Strings.

Bill
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

William Brogden wrote:What is generating this strange requirement?


I ask myself that every time I see this question. If it's a real business requirement, then yeah, it's a really strange one.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Generate XML / DOM using XSL and Xpath