File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Product and Other Certifications and the fly likes XSL question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "XSL question" Watch "XSL question" New topic

XSL question

Jun Hong
Ranch Hand

Joined: Sep 05, 2001
Posts: 181
Is there a way to copy a node in source file to result file? I am using XSL to transform a source XML to a result XML. Most of my source nodes can be used as result nodes. Basically, I just remove some unrelated nodes and build the result tree. So I hope I can copy useful nodes direclty. Right now, I have to use template to copy tags, attributes, and texts one by one. I hope there is a function called copyNodeRecursively() to copy a node recursively for me. Because the child nodes of a node may change and templates are not dynamic, I really need this kind of function. Does it exit?

Jun Hong<br />SCJP, SCJD, SCWCD, SCEA<br />IBM Certified Systems Expert(V4.0)
Shashank Tanksali
Ranch Hand

Joined: Feb 21, 2001
Posts: 122
You can use xsl:copy-of to do a deep (recursive) copy.
Hope this helps.

<b><br /><a href="" target="_blank" rel="nofollow">Shashank Tanksali</a><br /><i><br />SCJP2,SCJD2,SCWCD<br />IBM Certified Developer - XML and Related Technologies<br />PMI Certified Project Management Professional<br /></i><br /></b>
Jun Hong
Ranch Hand

Joined: Sep 05, 2001
Posts: 181
Thank you so much. I tried copy-of and it works. I do appreciate your help.
I agree. Here's the link:
subject: XSL question
It's not a secret anymore!