xsl-list
[Top] [All Lists]

[xsl] Making nested elements from elements with level attributes

2010-09-21 23:57:18


Hi,

I have section elements that level attributes like the following:

<section level=1>
<paragraph>Test line</paragraph>
</section>
<section level=2>
<paragraph>Test line</paragraph>
</section>
<section level=2>
<paragraph>Test line</paragraph>
</section>
<section level=3>
<paragraph>Test line</paragraph>
</section>
<section level=4>
<paragraph>Test line</paragraph>
</section>
<section level=5>
<paragraph>Test line</paragraph>
</section>
<section level=3>
<paragraph>Test line</paragraph>
</section>


I would like to transfrom that to something like:

<section>
<paragraph>Test Line</paragraph>
<section>
<paragraph>...</paragraph>
</section>
<section>
<paragraph/>
<section>
<paragraph/>
<section>
<paragraph/>
<section>
<paragraph/>
</section>
</section>
<section>
<paragraph/>
</section>

Is there an elegant algorithim to do this, or am i looking at a recursive 
routine with a named template?

Thanks,


Russ
</section>

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--