Marc wrote:
> I try to insert a Node child of the document node.
> To do this after many tries, I use the xpathSearch to select the first child
> of the document node, but I'm unable to run it.
> Here is my sample :
> ---------- the XML file :---------------
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Projet PUBLIC "LPAC Projet"
> "d:\xml\projet.dtd">
> <Projet>
> <Repertoires>
> <SourceLocal Valeur="c:/" />
>
> <PublierLocal Valeur="c:/" />
>
> <SourceServeur Valeur="c:/" />
>
> <PublierServeur Valeur="c:/" />
> </Repertoires>
> </Projet>
> ---------- the XXE extract :---------------
> <cfg:command name="Unedic-Projet.InsererCopie">
> <cfg:macro trace="true">
> <cfg:sequence>
> <cfg:command name="xpathSearch" parameter="//Repertoires"/>
> <cfg:command name="insert after Copies"/>
> </cfg:sequence>
> </cfg:macro>
> </cfg:command>
>
> Perhaps it's a problem of namespace?
No. No namespace problem.
--> I haven't tested it, but something like this should work fine.
<cfg:command name="Unedic-Projet.InsererCopie">
<cfg:macro trace="true">
<cfg:sequence>
<cfg:set variable="selectedElement"
expression="//Repertoires[1]" />
<cfg:command name="insert" parameter="after Copies" />
</cfg:sequence>
</cfg:macro>
</cfg:command>
See
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/macro_reference.html
See
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/insert.html
--> xpathSearch is the command which is behind Select|Find Element
See http://www.xmlmind.com/xmleditor/_distrib/doc/commands/xpathSearch.html
This command is generally not meant to be used in macro commands.
See
http://www.xmlmind.com/xmleditor/_distrib/doc/help/selection_and_selectMenu.html#selectMenu