Basic macro for xml export with attributes

Hello,

to export pages of a writer document into an xml document i use the code in this answer.

Now i want the page number as an attribute, like this:

<pages>
 <page number=1>
 Text of page 1
 <\page>
 <page number=2>
 Text of page 2
 <\page>
<\pages>

How do I do this?

Hello again @daniel1,

This can be done by adding just 1 line of code inside the method Writer_Export_Pages_To_XML().

The line to add is: oPage.setAttribute( "number", i)

This line should be inserted directly after the line: oPage = oXML.createElement( "page" )

HTH, lib

Thank you, that works!