btw. sorry the closing tag should be of course </list>.

2011/5/31 Marvin Reimer <therealmarv@googlemail.com>
Hello,

I hope this is ok to ask here in Saxon Help Mailing List. I'm a GSoC Student and working currently on a Google Docs to XML conversion.

I have following problem. I worked two days on a solution but I cannot find one.

I have a list with uncommon level-attribute (lists are only represented with margins in GDocs) and I want to re-level (sort) the nodes without restructuring the XML.

My input:

<lists>
  <list margin="10">1</level>
  <list margin="15">2</level>
  <somethingelse/>
  <list margin="33">3</level>
  <list margin="15">4</level>
  <list margin="64">5</level>
  <list margin="72">6</level>
</lists>

My desired output:

<lists>
  <list level="1">1</level>
  <list level="2">2</level>
  <somethingelse/>
  <list level="1">3</level>
  <list level="1">4</level> <!-- this is also Level 1 because first node level with preceding-sibling no level node has always level 1 -->
  <list level="2">5</level>
  <list level="3">6</level>
</lists>


Is this also possible to do with XSLT 1.0 ?

Thank you,
Marvin