xsl-list
[Top] [All Lists]

Re: multi-paragraph blockquotes

2005-05-06 17:14:28

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!


--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>