[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [wsbpel] Issue - 157 - Proposal For Vote
Hi Ugo, Ugo wrote: "... we just modify the original source tree ..." It seems to me that you are still suggesting the XSLT processor would modify the source tree during XSLT processing. Is my understanding right?? As for case (1) vs case (2), could I paraphrase a little bit for clarity? ------------------------------------ Case (1) - the result tree is a real new tree and the original source tree stay unmodified for a short time (during the XSLT transformation executation). The result tree is as a tree distinct from the source tree, but after <assign>/<copy> is completed, the original source tree is gone and replaced. ------------------------------------ Then, you ask whether "XSLT could distinguish case 1 from case 2". I would say yes it can. Instead of discussing in vaccum without context, let me give an example: ----------------------------- <assign> <copy> <from variable="var1" stylesheet="dummy.xslt" /> <to variable="var1" /> </copy> </assign> ----------------------------- dummy.xslt: ------------------------- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="foo[./../bar[@attr='abc']"> <xsl:element name="foo2"> <xsl:attribute name="attr><xsl:value-of select="@attr" /></xsl:attribute> </xsl:element> </xsl:template> <xsl:template match="bar[./../foo[@attr='def']"> <xsl:element name="bar2"> <xsl:attribute name="attr><xsl:value-of select="@attr" /></xsl:attribute> </xsl:element> </xsl:template> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> ------------------------- After executing the transformation and <assign>/<copy> above, "var1" is supposed to change from: ------------------------- <myDoc> <segment> <foo attr="def" /> <bar attr="abc" /> </segment> <segment> <foo attr="123" /> <bar attr="456" /> </segment> </myDoc> ------------------------- to: ------------------------- <myDoc> <segment> <foo2 attr="def" /> <bar2 attr="abc" /> </segment> <segment> <foo attr="123" /> <bar attr="456" /> </segment> </myDoc> ------------------------- For case (1), the result tree (being copied into "var1" pointed by to-spec by <copy>) is a real new tree and the original source tree (in "var1" pointed by from-spec) stay unmodified for a short time (during the XSLT transformation executation). The result tree is as a tree distinct from the source tree, but after <assign>/<copy> is completed, now the original source tree is gone. For case (2), the result tree is actually a modification of the original source tree. (That is no distinct copies between source tree and the result tree for "var1".) Actually above XSLT logic will fail, because "foo" is replaced by "foo2". And, the condition related to replacing "bar" with "bar2" is NO LONGER VALID, because the sibiling checking predicate fails. This example illustrate it is important to keep the source tree unmodified during the execution of XSLT. Summary
Thanks! Regards, Alex Yiu Ugo Corda wrote:
|
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]