For example, I could have an ordered list followed by an
unordered list, which would give a group like:
<p type="li" container="ol" level="1">
<p type="p" container="li" level="2">
<p type="li" container="ol" level="1">
<p type="p" container="li" level="2">
<p type="li" container="ul" level="1">
<p type="p" container="li" level="2">
Where the result should be:
<ol>
<li>
<p>
</li>
<li>
<p>
<li>
</ol>
<ul>
<li>
<p>
<li>
</ul>
I don't see a way to get that result using
group-starting-with on the group members.
I haven't followed the thread closely, but I would tackle the above by first
using group-starting with to build the levels
<xsl:for-each-group select="*" group-starting-with="*[(_at_)level='1']">
applied recursively if necessary for each level, giving
<p type="li" container="ol" level="1">
<p type="p" container="li" level="2">
</p>
<p type="li" container="ol" level="1">
<p type="p" container="li" level="2">
</p>
<p type="li" container="ul" level="1">
<p type="p" container="li" level="2">
</p>
and then apply group-adjacent to the level 1's (and perhaps recursively to
each level?):
<xsl:for-each-group select="*" group-adjacent="@container">
<xsl:element name="{current-grouping-key()}">
<xsl:copy-of select="current-group()"/>
</
</
to give your required structure, with a bit of trivial tweaking needed to
change <p type="li"> to <li>.
Regards,
Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay
--~------------------------------------------------------------------
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>
--~--