Note that there are some explanatory texts on larger screens.

plurals
  1. POSorting node attributes and keeping structure in XSLT
    primarykey
    data
    text
    <p>I have following problem. I worked two days on a solution but I cannot find one.</p> <p>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.</p> <p>My input:</p> <pre class="lang-xml prettyprint-override"><code>&lt;lists&gt; &lt;list margin="10"&gt;1&lt;/list&gt; &lt;list margin="15"&gt;2&lt;/list&gt; &lt;somethingelse/&gt; &lt;list margin="33"&gt;3&lt;/list&gt; &lt;list margin="72"&gt;4&lt;/list&gt; &lt;list margin="15"&gt;5&lt;/list&gt; &lt;list margin="64"&gt;6&lt;/list&gt; &lt;list margin="72"&gt;7&lt;/list&gt; &lt;/lists&gt; </code></pre> <p>This output would be ok:</p> <pre class="lang-xml prettyprint-override"><code>&lt;lists&gt; &lt;list level="1"&gt;1&lt;/list&gt; &lt;list level="2"&gt;2&lt;/list&gt; &lt;somethingelse/&gt; &lt;list level="1"&gt;3&lt;/list&gt; &lt;list level="3"&gt;4&lt;/list&gt; &lt;list level="1"&gt;5&lt;/list&gt; &lt;list level="2"&gt;6&lt;/list&gt; &lt;list level="3"&gt;7&lt;/list&gt; &lt;/lists&gt; </code></pre> <p>My desired output (level difference between two nodes should only be 1)</p> <pre class="lang-xml prettyprint-override"><code>&lt;lists&gt; &lt;list level="1"&gt;1&lt;/list&gt; &lt;list level="2"&gt;2&lt;/list&gt; &lt;somethingelse/&gt; &lt;list level="1"&gt;3&lt;/list&gt; &lt;list level="2"&gt;4&lt;/list&gt; &lt;list level="1"&gt;5&lt;/list&gt; &lt;list level="2"&gt;6&lt;/list&gt; &lt;list level="3"&gt;7&lt;/list&gt; &lt;/lists&gt; </code></pre> <p>Is this also possible to do with XSLT 1.0 ?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload