Carsten Milling wrote:
> On Tue, Dec 02, 2008 at 07:18:49PM +0100, Hussein Shafie wrote:
>> * If you want to use your XSLT style sheets, it is also possible to
>> write a simple macro-command --
>> http://www.xmlmind.com/xmleditor/_distrib/doc/commands/macro.html -- which:
>>
>> [1] Save the document being edited to disk using "XXE.save [ifNeeded]"
>> -- http://www.xmlmind.com/xmleditor/_distrib/doc/commands/XXE.save.html.
>>
>> [2] Invokes your XSLT scripts by the means of a process command --
>> http://www.xmlmind.com/xmleditor/_distrib/doc/commands/process.html --
>> to transform the file containing the document being edited.
>>
>> [3] Uses "XXE.open [reopen]" --
>> http://www.xmlmind.com/xmleditor/_distrib/doc/commands/XXE.open.html --
>> to replace the document being edited by the updated one.
> 
> this is great. I used this to implement a nice feature in one of my
> own XXE projects.
> 
> I have one tiny issue though: My XSLT transformation slightly changes
> the indentation and white space distribution in the resulting
> document. 

Normally, such indentation is ignored by XXE. I don't see what kind of
troubles this could cause.



> That's why I would like to make XXE automatically (re)save
> the document after reopening it. What would be the best way to achieve
> this? I tried to add some commands after XXE.open to modify and save
> the document. But, apparently, these commands are not executed at
> all. Is that expected behavior? I'm using XXE 4.1.0 Personal Edition.
> 

Yes. A macro-command runs in the context of the document being edited.
Let's call it documentA. The macro-command saves documentA to disk,
applies an XSLT transformation to it and reopen it to XXE. The document
reopened in XXE is documentA', not the original documentA. And the
macro-command that was applied on documentA, has no effect on documentA'.

In a nutshell, you cannot add any subsequent command after a "XXE.open".



---
PS: A bit overkill: add a shell child element to you process command --
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/shell.html -- in
order to execute xmltool indent --
http://www.xmlmind.com/xmleditor/_distrib/doc/xmltool/index.html -- to
re-indent your XML file exactly like XXE.


Reply via email to