I take the liberty of exposing my ignorance of how to use the cool grouping features of xslt on the list, in the hope that someone will take pity on me and explain what's going on here.

My input file (in the HTML namespace) contains chunks like this:

<div class="wpvw-motto"><span class="cursief">Waarde Meryan!</span>
<br/>
‘In aanmerking genomen onze gewoonlijk niet heel drukke (!) correspondentie, 
...  Dus, vous voilà prévenu, le pire est fait.
<br/>
‘Weet dan ...  voet voortleven en ten slotte totaal geruïneerd! Hij, <span 
class="cursief">zeer</span> plotseling gestorven.... gij begrijpt mij wel!
<br/>
</div>

which I want to transform  (obviously) to something like this

<quote><hi rend="italic">Waarde Meryan!</hi>
<p>
‘In aanmerking genomen onze gewoonlijk niet heel drukke (!) correspondentie, 
...  Dus, vous voilà prévenu, le pire est fait.
</p>
<p>
‘Weet dan ...  voet voortleven en ten slotte totaal geruïneerd! Hij, <hi 
rend="italic">zeer</hi> plotseling gestorven.... gij begrijpt mij wel!
</p>
</quote>


My stylesheet has a template for div[@class] which contains the following:

|||<xsl:when test="@class = 'wpvw-motto'">|
|<quote>|
|<xsl:for-each-group select="node()" group-ending-with="h:br">|
|<xsl:for-each select="current-group()">|
|<p>|
|<xsl:choose>|
|<xsl:when test="self::h:br"/>|
|<xsl:when test="self::h:span">|
|<xsl:apply-templates select="."/>|
|</xsl:when>|
|<xsl:otherwise>|
|<xsl:apply-templates select="."/>|
|</xsl:otherwise>|
|</xsl:choose>|
|</p>|
|</xsl:for-each>|
|</xsl:for-each-group>|
|</quote>|
|</xsl:when>|

and another for span which handles the conversion to <hi>

... and this NEARLY works. But not quite. It generates

|<quote><p>||
||<hi rend="italic">Waarde Meryan!</hi> </p>||
||<p>||
||‘In aanmerking genomen onze gewoonlijk niet heel drukke (!) correspondentie, ... Dus, vous voilà prévenu, le pire est fait.||
||</p>>||
||<p>||
||‘Weet dan ... voet voortleven en ten slotte totaal geruïneerd! Hij, </p>||
||<p><hi rend="italic">zeer</hi></p>||
||<p>||plotseling gestorven.... gij begrijpt mij wel! ||
||</p>||
||</quote>|

i.e. it looks as if the current-group starts a new sequence for each h:div child, rather than for each <br/>. So I am misunderstanding something fairly fundamental about how this grouping mechanism works.

Any and all advice gratefully received!

Lou



_______________________________________________
oXygen-user mailing list
oXygen-user@oxygenxml.com
https://www.oxygenxml.com/mailman/listinfo/oxygen-user

Reply via email to