Klocker Christoph wrote:
> Hi,
>
> tried now different ways, couldn't get it working....
>
> my macro looks like you said,
>
> <cfg:command name="insertNumListenPunkt">
> <cfg:macro>
> <cfg:sequence>
> <cfg:command name="selectNode"
> parameter="ancestor[implicitElement] punkt"/>
> <cfg:command name="paste" parameter="after <?xml
> version='1.0'?>listnum></listnum><punkt><absatz></absatz></punkt>"/>
> </cfg:sequence>
> </cfg:macro>
> </cfg:command>
>
> It stops working after the first command.
> I suppose it has something to do with my schema, as if I change it a bit, the
> command executes.
>
> my schema looks like this
> <xs:element name="nummerierte_liste">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="ueberschrift" minOccurs="0"/>
> <xs:sequence maxOccurs="unbounded">
> <xs:element name="listnum"/>
> <xs:element ref="punkt"/>
> </xs:sequence>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
> I think the problem is, that I can't even insert a new listnum and punkt, by
> pressing the "InsertAfter" button. While the punkt node() is selected I
> cannot even select the InsertAfter button as it is greyed out,.
No. "Insert After" simply cannot be used to insert *two* elements at the
same time (listnum and punkt).
But the above macro-command based on "Paste After" can paste these two
elements at the same time.
Now, your macro-command cannot work because:
[1] The parameter of the command is not well-formed XML (you forgot a
"<" before first "listnum").
[2] I forgot to wrap the two elements in a
{http://www.xmlmind.com/xmleditor/namespace/clipboard}clipboard envelope.
Try this version:
---
<cfg:command name="insertNumListenPunkt">
<cfg:macro>
<cfg:sequence>
<cfg:command name="selectNode"
parameter="ancestor[implicitElement] punkt"/>
<cfg:command name="paste" parameter="after
<?xml version='1.0'?>
<ns:clipboard
xmlns:ns='http://www.xmlmind.com/xmleditor/namespace/clipboard'>
<listnum>
</listnum>
<punkt>
<absatz>
</absatz>
</punkt>
</ns:clipboard>"/>
</cfg:sequence>
</cfg:macro>
</cfg:command>
---
Note that if listnum and punkt have a namespace, a proper xmlns
attribute must be added to the parameter of the "Paste After" command.