Re: [xsl] Grouping problem. 2.0

Subject: Re: [xsl] Grouping problem. 2.0
From: Dave Pawson <davep@xxxxxxxxxxxxx>
Date: Fri, 04 Jul 2008 19:21:03 +0100
Dave Pawson wrote:

Andrews solution is good, but outputs

   <block sect="1">
      <para>Copyright ) OASIS. 20022007. All Rights ....</para>
      <para>All capitalized terms in the following t ....</para>
      <para>This document and translations of it may ....</para>
      <para>The limited permissions granted above ar ....</para>
      <para>This document and the information contai ....</para>
      <para>OASIS requests that any OASIS Party or a ....</para>
      <para>OASIS invites any party to contact the O ....</para>
      <para>OASIS takes no position regarding the va ....</para>
      <para>The names "OASIS", OpenDocument, Open ....</para>

I.e. the numbering is out by one since the document
doesn't start with a header.
I'm working on Andrews Solution to see if I can hack round it

<xsl:template match="/"> <bk>

<!-- Collate all blocks (== title, para* ) -->
<xsl:variable name="blocks">
<xsl:for-each-group select="/book/*" group-starting-with="*[self::title]">
<xsl:copy-of select="current-group()"/>

<xsl:variable name="nested">
<xsl:call-template name="nest">
<xsl:with-param name="nodes" select="$blocks//block[not(position() = 1)]"/>

    <xsl:apply-templates select="$nested/*"/>

Just needed to ignore the first block. Now working.

Many thanks Andrew. Numbering now matches the spec

   <block sect="1">
   <block sect="1.1">
      <para>This document defines an XML schema for ....</para>
      <para>The schema provides for high-level infor ....</para>
      <para>Chapter 1 contains the introduction to t ....</para>
      <para>Chapter 8 describes the table content of ....</para>
      <para>The OpenDocument format makes use of a p ....</para>
   <block sect="1.2">
      <para>Within this specification, the key words ....</para>


Dave Pawson

Current Thread