Marsoner Stephan wrote:
> I tried to write a simple (generic) macro to goto the next element of
> the same name as implicitElement *in document order* but did't succeed.
> I looked at selectNode and get & set commands, but didn't arrive at a
> solution :(((

The trick is to know about and use current(), a standard XSLT function.

---
   <command name="nextElement">
     <macro>
       <sequence>
         <set variable="selected"
              context="$implicitElement"
           expression="following::*[local-name(.) = 
local-name(current())][1]"/>

         <command name="center" />

         <set variable="dot" context="$selected"
              expression=".//text()[1]" />
       </sequence>
     </macro>
   </command>
---

Please find ready to use macro in attached customize.xxe.



> Equally I didn't manage to write a "go back to last selected element"
> macro, as I don't know how to share info between macros without an
> similar example (define a user variable with some special namespace?) 

I suppose that you can do that with a user variable having 
"http://www.xmlmind.com/xmleditor/namespace/scope/view"; as its namespace.

Mark element in macro #1:

---
<set variable="foo:bar" 
xmlns:foo="http://www.xmlmind.com/xmleditor/namespace/scope/view"; 
expression="$selected" />
---

and select previously marked element in macro #2:

---
<set variable="selected" 
xmlns:foo="http://www.xmlmind.com/xmleditor/namespace/scope/view"; 
expression="$foo:bar" />
---

See 
http://www.xmlmind.com/xmleditor/_distrib/docs/commands/ch04s01s03.html#d0e1985
-------------- next part --------------
A non-text attachment was scrubbed...
Name: customize.xxe
Type: text/xml
Size: 741 bytes
Desc: not available
Url : 
http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20041119/c588c29c/attachment.xml
 

Reply via email to