[Home] [By Thread] [By Date] [Recent Entries]
Paramdeep Ahuja wrote:
HiIf you are trying to do this using an XSLT library (as opposed to a command line utility) Apache Xalan allows you to apply a transformation to a sub-tree of the DOM tree. However, the root tree is not modified but you can simulate this behaviour as such: 1. If the subtree(s) that you want to modify are not *all* the children of a node, create a document fragment and copy/move them there. 2. Apply the transformation using the document fragment as root (or to the root of the nodes if (1) doesn't hold) 3. Replace the initial nodes in the source tree with the result (which will normally be the children of another document fragment that you provide) There are two catches in this: 1st) It's dead slow 2nd) The "/" construct in XSLT always applies to the root of the document and not the root that you specifiy during the transformation function call. So, your stylesheets should only use relative constructs. I'm using this techniques a lot since we have implemented a transformation engine that among others handles subtrees individually. If anyone has a better solution (faster) please let me know! Hope this helps, Mike. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|

Cart



