<?xml version='1.0'?>
<!DOCTYPE doc SYSTEM "../../../../lib/xml/xsl.dtd" >
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:x="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="x">
 
 <xsl:output method="xhtml" indent="no"/>
 
 <xsl:template match="x:body">
  <xsl:variable name="pre" select="x:a[@href='summa.FP_Q1.html'][1]"/>
  <xsl:copy>
   <xsl:apply-templates select="@*"/>
   <xsl:for-each select="$pre">
   <xsl:apply-templates select="preceding-sibling::*"/>
   <xsl:apply-templates select="."/>
   <xsl:for-each-group select="following-sibling::*" group-starting-with="x:h1[@id='viii-p0.1']">
    <xsl:choose>
     <xsl:when test="position()=1">
      <xsl:for-each-group select="current-group()" group-starting-with="x:h2">       <xsl:variable name="name" select="translate(substring-before(./@id,'-'),'.','_')"/>
    <xsl:message>f: <xsl:value-of select="$name"/>|<xsl:value-of select="local-name()"/>|<xsl:value-of select="count(current-group())"/></xsl:message>
<xsl:text>&#10;</xsl:text>
    <xi:include href="{$name}.html"/>
    <xsl:result-document method="xhtml" href="{$name}.html">
     <div><xsl:apply-templates select="current-group()" mode="subdoc"/></div>
    </xsl:result-document>
      </xsl:for-each-group>
<xsl:text>&#10;</xsl:text>
     </xsl:when>
     <xsl:otherwise>
      <xsl:apply-templates select="current-group()"/>
     </xsl:otherwise>
    </xsl:choose>    
   </xsl:for-each-group>
  </xsl:for-each></xsl:copy>
 </xsl:template>
 
 <xsl:template match="node()|@*">
  <xsl:copy>
   <xsl:apply-templates select="node()|@*"/>
  </xsl:copy>
 </xsl:template>
 
 <xsl:template match="node()|@*" mode="subdoc">
  <xsl:copy>
   <xsl:apply-templates select="node()|@*"/>
  </xsl:copy>
 </xsl:template>
</xsl:stylesheet>
