Am 28.11.2011 14:00, schrieb Hussein Shafie:
> Please note that recent versions of XXE allow to embed an XSLT
> stylesheet in a <macro>, which is often simpler and more efficient
> than <process showProgress="false">.
>
> See
> http://www.xmlmind.com/xmleditor/_distrib/doc/commands/macro_reference.html
First of, I would like to say thank you for your instant and precious help,
Hussein.
Yes, I am aware of the alternative of running a transform from inside a macro.
As I understand the docs, this *requires* putting the whole stylesheet
lexically into the macro, which is what I would like to avoid, because I prefer
to keep my rather large stylesheet in a file of its own.
But I might not have another choice, see below...
>> Remembering that the root element can't be replaced in XXE through
>> the Edit menu, I wonder if this restriction also applies if the
>> name and attributes of the root element remain unchanged in the
>> results of command transform.
>
> Yes, that right. This restriction applies always.
>
> [...]
>> How could I manage to transform my document in-place (or make it
>> seem as if it happened that way)?
>>
>
> You could do something like this (not tested, not 100% sure):
Following your excellent advice, I came up with two pieces which go halfway
each, but which I still need to connect to each other. Generating nodes in
XXE's clipboard format with XSLT works fine, and replacing the selected root
element child nodes with clipboard content seems to be OK, too.
I only don't manage yet to take over the XSLT output, i.e. get it into the
macro variable %_ for pasting. Currently, I have these two commands and wonder
how to properly "connect" them (is this only possible when using the transform
as a macro command?):
<command name="mytransform_internal">
<process showProgress="false">
<copyDocument to="TMP_in.xml" />
<transform stylesheet="mytransform.xsl"
version="2.0"
file="TMP_in.xml" to="TMP_out.xml" />
<read file="TMP_out.xml" encoding="UTF-8" />
</process>
</command>
<command name="mytransform">
<macro>
<sequence>
<command name="mytransform_internal"/>
<!-- how to put the results into %_ here? -->
<set variable="rootContents"
expression="%_" plainString="true"/>
<set variable="selected" expression="/*" />
<command name="selectNodes" parameter="children" />
<get expression="$rootContents" />
<command name="paste" parameter="to %_" />
</sequence>
</macro>
</command>
What am I missing here?
Yves
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support