Subject: [xsl] Updating xml - difference between MSXML and Xalan From: "Pete & Angie Taylor" <pandatay@xxxxxxxxxxxxx> Date: Thu, 25 May 2006 21:44:17 +0100 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xml + xslt > saxon 8 > fo, J.Pietschmann | Thread | RE: [xsl] Updating xml - difference, Michael Kay |
Re: [xsl] xml + xslt > saxon 8 > fo, J.Pietschmann | Date | Re: [xsl] XSLT 1: From flat XML to , Abel Braaksma Online |
Month |