Re: [xsl] multi-paragraph blockquotes

Subject: Re: [xsl] multi-paragraph blockquotes
From: Bruce D'Arcus <bdarcus@xxxxxxxxx>
Date: Fri, 6 May 2005 20:14:28 -0400
On May 6, 2005, at 12:09 PM, David Carlisle wrote:

So for HTML or XHTML1.x I think that using a div (which basically is p
with a fixed content mode) produces semantically more meaningful html
files than using p and arbitrarily splitting up a paragraph into
multiple p's so that block level elements come between teh
sub-paragraphs not within them.

I understand your point on this David, but in my case I need to be able to match my output to the logic of input systems (in this case Word*), so I went with this solution:


<xsl:template
match="db:section/db:para | db:chapter/db:para | db:article/db:para">
<xsl:for-each-group select="node()"
group-adjacent="self::db:orderedlist or self::db:unorderedlist or self::db:blockquote">
<xsl:choose>
<xsl:when test="current-grouping-key()">
<xsl:copy-of select="current-group()"/>
</xsl:when>
<xsl:otherwise>
<p>
<xsl:copy-of select="current-group()"/>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each-group>
</xsl:template>


I still want to figure out how to assign different class attributes depending on where the p element is ("body text" vs. "body text first indent"), but this works nicely for now.

Bruce

* As with a lot of publishers, mine asks for Word docs. I consider it an accomplishment that they didn't freak when I gave them xhtml!

Current Thread