Re: [xsl] Is it possible to modify an XML by XSLT "in-place" (directly replace) ?

Subject: Re: [xsl] Is it possible to modify an XML by XSLT "in-place" (directly replace) ?
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Thu, 08 Oct 2009 12:13:47 +0200
Ben Stover wrote:
Normally the user applys an XSLT style sheet onto a source XML file or variable
and the result XML will be stored into ANOTHER file or variable.
Thats the "traditional" way of processing XSLT.

I don't quite agree with that. I would rather say that an input tree, often created by parsing an XML document, is transformed to an output tree that can then be optionally serialized as XML or HTML or text.
And XSLT processors don't have problems in my experience to parse one file to create the input and then to serialize the output tree to the same file.


But what, if I want to replace the original file or variable completely?

Check the API or command (line) options of your XSLT processor, it should have options to provide a file name for input and file name for output and you should not get any problems if you provide the same file name for input and output.


The only problem you can run in in my experience is XSLT 2.0 with xsl:result-document providing a URL for output which is also accessed as input e.g. using doc or document functions.



--

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/

Current Thread