This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
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

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
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
jQuery in Action, 3rd edition