wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes Any way to specify nodes to copy without filtering? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Any way to specify nodes to copy without filtering?" Watch "Any way to specify nodes to copy without filtering?" New topic
Author

Any way to specify nodes to copy without filtering?

Darrin Smith
Ranch Hand

Joined: Aug 04, 2003
Posts: 276
I know how to do an identity transform, and I know how to filter specific nodes out of it, but how do I specify that you copy only specific nodes and everything else (comments, etc.)? The reason why I do that is because the XML that the XSLT is to be applied to may grow (new nodes) and I want to exclude all new nodes. A filter will only exclude a set of the current ones.

For example:




Suppose all I wanted to see was:




What should the xslt look like to accomplish that?

I thought that I could try to first copy over all non-nodes then focus on the nodes and list the specific ones I wanted to copy but I could not get it to work.

What I have now is just a filter like this



Again, I don't want to filter out specific nodes like this does. I just want to copy specific ones!

Thanks.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

So you want to filter out all elements except for a certain list? Your XPath expression for that is something like this:
Darrin Smith
Ranch Hand

Joined: Aug 04, 2003
Posts: 276
Paul Clapham wrote:So you want to filter out all elements except for a certain list? Your XPath expression for that is something like this:


Yes that's pretty much it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Any way to specify nodes to copy without filtering?
 
Similar Threads
[XSLT] remove a particular node
How to delete empty tag from XML
Unnecessary Tags
to EXACT Dublicate an xml file[xml->xml] via Java TransformerFactory classes and XSTL well I do not
[XSL] XML to XML without empty element