xsl-list
[Top] [All Lists]

Re: [xsl] grabbing chunks of preceding-siblings between tables

2007-10-04 09:34:03
On Thu, Oct 04 2007 16:40:18 +0100, spencertickner(_at_)gmail(_dot_)com wrote:
Thanks in advance for the help. I'm doing some pre-processing of a XML
Dump of tables. I'm trying to associate header information in the
table to the table itself. I'm having difficulty figuring out how to
do this.. Anyway, examples always seem to say it better (XSLT 2.0 is
fine):

XSLT 2.0 makes it much easier:

------------------------------------------------------------
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="2.0">

  <xsl:output method="xml"/>

  <xsl:template match="root">
    <xsl:copy>
      <xsl:for-each-group
        select="*"
        group-ending-with="table">
        <table>
          <xsl:apply-templates select="current-group()"/>
        </table>
      </xsl:for-each-group>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="table">
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="*">
    <xsl:copy>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>
------------------------------------------------------------

You don't show any attributes, so I didn't add anything to handle them.

Regards,


Tony Graham.
======================================================================
Tony(_dot_)Graham(_at_)MenteithConsulting(_dot_)com   
http://www.menteithconsulting.com

Menteith Consulting Ltd             Registered in Ireland - No. 428599
Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
----------------------------------------------------------------------
Menteith Consulting -- Understanding how markup works
======================================================================

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