[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: acccessing and changing result tree nodes
Hi, > How do I access result tree nodes and change the value > based upon some conditions? You don't. You can, however, generate a RTF, convert that into a node-set and then process that. > Normally all match or test attributes point to source > tree. > > I have a situation where in the same xsl file, an > attribute is being generated somewhere deep in the > result tree. This attribute is also being copied from > source tree to result in some other places in the > tree. After all this processing is complete, I now > must recheck the value of this attribute in the result > tree (no matter where in the tree it occurs) and if > it is emtpy, make it equal to the value of another > attribute that is also present in the same element and > may have itself be generated anew or copied from > source to result tree. Are you sure you can't do this without two passes, be it using temporary tree or actually with two transformations? It would probably require a lot more tree navigation and re-doing some things just to generate the value of the attribute, but often times it can be done. > I know one way is to split the process into 2 stages > and create a second xsl file but I am looking for > above solution for performance reasones. Doing two piped transformations can be faster than trying to do everything in one go due to less tree navigation. Also, separating the transformation will most likely make your stylesheets and logic more readable and maintainable. Of course you have to implement the piped transformation, but it's fairly trivial using e.g. JAXP (,thought it should be easier still). Cheers, Jarno
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|