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

RE: Updating xml - difference between MSXML and Xalan

Subject: RE: Updating xml - difference between MSXML and Xalan
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 26 May 2006 09:27:50 +0100
how to xalan improve performance
In XSLT 1.0, the effects of starting a transformation at a node other than
the root are not defined, so products can do what they like.

In 2.0, "/" is defined to match the root node even if the transformation
started deep within the document.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Pete & Angie Taylor [mailto:pandatay@xxxxxxxxxxxxx] 
> Sent: 25 May 2006 21:44
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Updating xml - difference between MSXML and Xalan
> 
> Dear List,
> 
> We have a working document that can get large (100kb + ) and 
> is frequently updated by being transformed and then 
> completely replaced by the transformation result - a sort of 
> xslt master file update.
> 
> I am trying to improve performance by only transforming the 
> nodes that need to change, avoiding the high cost of 
> repeatedly copying the 90% plus that does not change each time.
> 
> The basic idea is for my application code to identify one or 
> more templates that handle the changes (name startswith 
> "replace"), find all nodes that are matched by any of these 
> templates, transform each node, and replace each node with 
> the result of its transformation. (I.e. to do a number of 
> very small translations of particular nodes, rather than one 
> very large translation of the whole document.)
> 
> For example, if my working document looks like this -
> 
> <a>
>     <b>before</b>
> </a>
> 
> and I have a stylesheet with an identity template and a 
> template like this -
> 
> <xsl:template name="replace1" match="/a/b">
>     <xsl:copy>after</xsl:copy>
> </xsl:template>
> 
> then my application finds the template named "replace1", 
> finds the node that is matched by "/a/b" and transforms and 
> replaces just that node. The result is -
> 
> <a>
>     <b>after</b>
> </a>
> 
> When I transform the non-root <b> node rather than the whole 
> document, MSXML matches it with the "replace1" template, and 
> I get the result I expect. I can demonstrate a huge saving 
> when repeatedly making small updates to a large document.
> 
> But when I try to transform the <b> node in Xalan 
> (transformer.transform(new
> DomSource(node)) ) it fails to match my <b> node with the 
> path "/a/b". I can only get my <b> node to be matched by a 
> template with a match attribute of exactly "b".
> 
> My question is: if I transform a node other than the root 
> node of an xml document using xslt, should the node be 
> matched by a template which has a match starting from the 
> root? (Should my <b> node be matched by my "/a/b"
> template?) Any idea why Xalan doesn't seem to do it? Is it 
> me? (It usually
> is!)
> 
> Thanks in advance - and thanks for many many interesting 
> posts in the past.
> 
> Pete Taylor

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.