Note that there are some explanatory texts on larger screens.

plurals
  1. POBuild a "path" with XSLT Recursion
    text
    copied!<p>I have a problem an at the moment no idea to solve it ;-(</p> <p>I have a category structure as input document (xml) and want to build a path structure. I can only use xslt and want to generate a new xml structure.</p> <p>The input structure looks like this:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;Positions&gt; &lt;Positionen&gt; &lt;ID&gt;1&lt;/ID&gt; &lt;Parent&gt;&lt;/Parent&gt; &lt;/Positionen&gt; &lt;Positionen&gt; &lt;ID&gt;2&lt;/ID&gt; &lt;Parent&gt;1&lt;/Parent&gt; &lt;/Positionen&gt; &lt;Positionen&gt; &lt;ID&gt;3&lt;/ID&gt; &lt;Parent&gt;1&lt;/Parent&gt; &lt;/Positionen&gt; &lt;Positionen&gt; &lt;ID&gt;4&lt;/ID&gt; &lt;Parent&gt;2&lt;/Parent&gt; &lt;/Positionen&gt; &lt;Positionen&gt; &lt;ID&gt;5&lt;/ID&gt; &lt;Parent&gt;4&lt;/Parent&gt; &lt;/Positionen&gt; &lt;Positionen&gt; &lt;ID&gt;6&lt;/ID&gt; &lt;Parent&gt;2&lt;/Parent&gt; &lt;/Positionen&gt; &lt;/Positions&gt; </code></pre> <p>The output structure should be this:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;Positions&gt; &lt;Positionen&gt; &lt;ID&gt;1&lt;/ID&gt; &lt;Parent&gt;&lt;/Parent&gt; &lt;Path&gt;1&lt;/Path&gt; &lt;/Positionen&gt; &lt;Positionen&gt; &lt;ID&gt;2&lt;/ID&gt; &lt;Parent&gt;1&lt;/Parent&gt; &lt;Path&gt;1/2&lt;/Path&gt; &lt;/Positionen&gt; &lt;Positionen&gt; &lt;ID&gt;3&lt;/ID&gt; &lt;Parent&gt;1&lt;/Parent&gt; &lt;Path&gt;1/3&lt;/Path&gt; &lt;/Positionen&gt; &lt;Positionen&gt; &lt;ID&gt;4&lt;/ID&gt; &lt;Parent&gt;2&lt;/Parent&gt; &lt;Path&gt;1/2/4&lt;/Path&gt; &lt;/Positionen&gt; &lt;Positionen&gt; &lt;ID&gt;5&lt;/ID&gt; &lt;Parent&gt;4&lt;/Parent&gt; &lt;Path&gt;1/2/4/5&lt;/Path&gt; &lt;/Positionen&gt; &lt;Positionen&gt; &lt;ID&gt;6&lt;/ID&gt; &lt;Parent&gt;2&lt;/Parent&gt; &lt;Path&gt;1/2/6&lt;/Path&gt; &lt;/Positionen&gt; &lt;/Positions&gt; </code></pre> <p>How can I do this with xslt with a recursion? Hoping fore some help. Thanks in advance. LStrike</p>
 

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