xsl-list
[Top] [All Lists]

Re: [xsl] Grouping: XHTML inline, block and flow

2008-03-27 03:46:47
On 27/03/2008, Raka Gator <plogbil(_at_)gmail(_dot_)com> wrote:
 <td>This is a <strong>wonderful</strong> table <p>but evil</p></td>

 I'd like that transformed into something like this (omitting lots of 
attributes
 for clarity):

 <table:table-cell>
  <text:p>This is a <text:span text:style-name="bold">wonderful
 </text:span> table</text:p>
  <text:p>but evil</text:p>
 </table:table-cell>

This is one for "group-adjacent":

<xsl:for-each-group select="node()" group-adjacent="not(self::p)">
  <xsl:choose>
    <xsl:when test="current-grouping-key()">
      <text:p><xsl:apply-templates select="current-group()"/></text:p>
    </xsl:when>
    <xsl:otherwise>
      <xsl:apply-templates select="current-group()"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:for-each-group>

...which is a slightly modified version of the last example from here:

http://www.w3.org/TR/xslt20/#grouping-examples


cheers
-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

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