[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XSL and DOM

Subject: Re: XSL and DOM
From: Michael Pediaditakis <mp49@xxxxxxxxx>
Date: Wed, 11 Jun 2003 19:03:17 +0100
creating xslt from dom tree
Paramdeep Ahuja wrote:

Hi

XSL transforms a source DOM tree into a target DOM Tree separate from the
source...Is it possible to apply the transformation on only a part of the
source DOM Tree and the changes be done in the same tree itself rather than
create a new DOM Tree as XSLT does...I wanted to know if this can be done
through some tool developed in Xalan C++


Thnx Param



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



If 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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.