Huditsch Roman wrote:
> I am in search for a simple if - then - else command sequence.
> Reading your documentation I could not figure it out myself.
> I tried several code constructs with <choice> and <test> but nothing worked.
>
> I would just like to test, if a variable's text is set to a value other than
> "LexisNexis".
> If that is true, a new attribute should be inserted with the appropriate
> value.
>
> <!-- IF ($foo:autor!='LexisNexis)-->
> <cfg:command name="pick" parameter="Kodex false AVG BR HR StrR VfR WohnG
> ZGV"/>
> <cfg:set variable="kodex" expression="%_" plainString="true"/>
> <cfg:get expression="$kodex"/>
> <cfg:command name="putAttribute" parameter="kodex %_"/>
> <!-- ELSE -->
> ...
---
<cfg:choice> <!--IF-->
<cfg:sequence>
<cfg:test expression="$foo:autor!='LexisNexis'"
xmlns:foo="http://www.xmlmind.com/xmleditor/namespace/scope/view"/><!--TEST-->
<cfg:command name="pick"
parameter="Kodex false AVG BR HR StrR VfR WohnG ZGV"/><!--THEN-->
<cfg:command name="putAttribute" parameter="kodex %_"/>
</cfg:sequence>
<cfg:sequence><!--ELSE-->
[...]
</cfg:sequence>
</cfg:choice>
---
And, if this does not not work, a possible reason would be that ``global
to the document view''-variable "$foo:autor" has not been initialized by
another macro-command.
---
PS: Your macro-commands seem to be often unnecessarily complex.
For example, what follows is useless:
---
<cfg:set variable="kodex" expression="%_" plainString="true"/>
<cfg:get expression="$kodex"/>
---