I have a question about the problem below which has already been
identified as a 'positional grouping problem'. (I think) I understand
the Muenchian method-based solutions suggested (at least in theory).
What I don't understand is what is wrong about using the following simple
solution that I pieced together from different postings:
<xsl:template match="li">
<xsl:if test="(name(preceding-sibling::*[1])!='li' )">
<xsl:text disable-output-escaping="yes"><ul></xsl:text>
</xsl:if>
<li><xsl:copy-of select="@*"/><xsl:apply-templates/></li>
<xsl:if test="(name(following-sibling::*[1])!='li' )">
<xsl:text disable-output-escaping="yes"></ul></xsl:text>
</xsl:if>
</xsl:template>
Seems like it fits much better into my context of using
'apply-templates' as much as possible (no need to process all li's at
once and ignore them later) and - except for that hack of
smuggling half the ul-element into my output - it also seems quite
reasonable xsl, not?
Your input much appreciated,
--
Ferdinand Soethe
--- The problem ---
I have an XML-document with paragraphs and list items that have no
wrapper element around each list.
Something like this:
<par>my first para</par>
<par>second para</par>
<li>first list item of first list</li>
<li>second list item of first list</li>
<li>third list item of first list</li>
<par>third para</par>
<li>first list item of second list</li>
<par>fourth para</par>
<li>first list item of third list</li>
<li>second list item of third list</li>
In my transformation I would like to add these implicit wrapper
element around each of the list to get something like
<p>my first para</p>
<p>second para</p>
<ul>
<li>first list item of first list</li>
<li>second list item of first list</li>
<li>third list item of first list</li>
</ul>
<p>third para</p>
<ul>
<li>first list item of second list</li>
</ul>
<p>fourth para</p>
<ul>
<li>first list item of third list</li>
<li>second list item of third list</li>
</ul>
--~------------------------------------------------------------------
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>
--~--