In a nutshell, any command found after XXE.open in a command sequence
will not be executed.
Why that? a command is executed in the context of the current view of
the current document.
After a successful XXE.open, for XXE, it's technically a different
document which is now opened and for which a new view is created.
This is easy to check by yourself:
---
<command name="reopenCurrentDocument">
<macro trace="true">
<sequence>
<command name="XXE.open" parameter="[reopen]" />
<command name="alert" parameter="Current document has been
reopened." />
</sequence>
</macro>
</command>
<binding>
<keyPressed code="F9" />
<command name="reopenCurrentDocument" />
</binding>
---
gives this trace:
---
-->reopenCurrentDocument:sequence: checking...
-->reopenCurrentDocument:command: checking...
XXE.open "[reopen]"
<--reopenCurrentDocument:command: can execute
<--reopenCurrentDocument:sequence: can execute
----------
==========
-->reopenCurrentDocument:sequence: executing...
-->reopenCurrentDocument:command: executing...
XXE.open "[reopen]"
<--reopenCurrentDocument:command: execution result='/'
-->reopenCurrentDocument:command: checking...
alert "Current document has been reopened."
<--reopenCurrentDocument:command: CANNOT EXECUTE
<--reopenCurrentDocument:sequence: execution result='/'
==========
---
The alert dialog is not displayed.
Sorry but there is no way to achieve what you want.
On 8/24/22 11:31, Madlik, Monika (LNG-VIE) wrote:
Hi Hussein,
many thanks for your advice! This works really good for me.
But now I have another question. I have to combine the new commands (adding the
DTD via XSLT and reloading the file via XXE.open [reopen]) with an existing one.
But after doing the XSL-transformation and the reopening of the file, the
second command won't be processed.
My source looks like this:
<cfg:command name="release_pre">
<cfg:macro>
<cfg:sequence>
<cfg:command name="save_with_nbsp"/>
<cfg:command name="release"/>
</cfg:sequence>
</cfg:macro>
</cfg:command>
<cfg:command name="save_with_nbsp">
<cfg:macro>
<cfg:sequence>
<cfg:command name="alert" parameter="IN SAVE NBSP"/>
<cfg:command name="selectNode" parameter="ancestorOrSelf[implicitElement] artikel"/>
<cfg:command name="XXE.save" parameter="[ifNeeded]"/>
<cfg:set variable="file_origin" expression="'%d'"/>
<cfg:get expression="$file_origin"/>
<cfg:command name="transform_save_with_nbsp" parameter="%_"/>
<cfg:command name="XXE.open" parameter="[reopen]"/>
<cfg:command name="alert" parameter="END SAVE NBSP"/>
</cfg:sequence>
</cfg:macro>
</cfg:command>
<cfg:command name="transform_save_with_nbsp">
<cfg:process showProgress="true">
<cfg:copyDocument selection="true" to="in.xml"/>
<cfg:transform stylesheet="xsl/transform_nbsp.xslt" version="2.0" file="in.xml"
to="out.xml" cacheStylesheet="true"/>
<cfg:upload base="%0">
<cfg:copyFile file="out.xml" to="%0"/>
</cfg:upload>
</cfg:process>
</cfg:command>
This works fine and does the transformation but after reloading the file
neither the alter nor the second command will be processed.
Can I force the second command ("release"), because it's important for me that
this runs in one single step so that the user can't forget about adding the dtd before
releasing the file.
Thanks a lot,
Monika
--
XMLmind XML Editor Support List
xmleditor-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support