I am having trouble sharing user variables between macros.
The following code works:
...
<cfg:set expression="$selected"
variable="saveSelected"></cfg:set>
<cfg:set expression="id($id)" variable="selected"></cfg:set>
<cfg:command name="selectNode" parameter="firstChild"/>
<cfg:set context="$selectedNode" expression="."
variable="preview"></cfg:set>
<cfg:set expression="$saveSelected"
variable="selected"></cfg:set>
<cfg:get expression="$preview"/>
<cfg:command name="putAttribute" parameter="[implicitElement]
preview
'%_'" />
...
If, however, I try to move a portion of the code to a different macro and
call it, as follows:
...
<cfg:set expression="$selected"
variable="saveSelected"></cfg:set>
<cfg:get expression="$id"/>
<cfg:command name="getPreview" parameter="%_" />
<cfg:get expression="$view:preview"/>
<cfg:command name="putAttribute" parameter="[implicitElement]
preview
'%_'" />
...
<cfg:command name="getPreview">
<cfg:macro>
<cfg:sequence>
<cfg:set expression="id(%0)" variable="selected"></cfg:set>
<cfg:command name="selectNode" parameter="firstChild"/>
<cfg:set context="$selectedNode" expression="."
variable="view:preview"></cfg:set>
</cfg:sequence>
</cfg:macro>
</cfg:command>
it no longer works: the <cfg:get expression="$view:preview"/> returns an
empty string.
I have included the following namespace declaration in the root
configuration element:
xmlns:view="http://www.xmlmind.com/xmleditor/namespace/scope/view"
What am I doing wrong?
Best regards
--------------
Kevin Flynn
Birdstep Technology www.birdstep.com
Mobile: +47 93433942