Re: [xsl] trying to create surrounding element

Subject: Re: [xsl] trying to create surrounding element
From: David Carlisle <davidc@xxxxxxxxx>
Date: Sun, 8 Jun 2008 22:38:31 +0100
<xsl:stylesheet  version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
 
<xsl:output indent="yes"/>

<xsl:template match="aaa">
 <xsl:for-each-group select="bbb" group-starting-with="bbb[ccc/ddd/@attribute='boxtype_start']">
  <box>
   <xsl:apply-templates select="current-group()"/>
  </box>
 </xsl:for-each-group>
</xsl:template>

<xsl:template match="bbb[ccc/ddd/@attribute='boxtype_start']">
   <xsl:comment select="eee"/>
</xsl:template>

<xsl:template match="bbb[ccc/ddd/@attribute='boxh1']">
   <title><xsl:value-of select="eee"/></title>
</xsl:template>

<xsl:template match="bbb[ccc/ddd/@attribute='boxh2']">
   <subtitle><xsl:value-of select="eee"/></subtitle>
</xsl:template>


<xsl:template match="bbb[ccc/ddd/@attribute='boxpara']">
   <para><xsl:value-of select="eee"/></para>
</xsl:template>

<xsl:template match="bbb[ccc/ddd/@attribute='boxtype_end']"/>

</xsl:stylesheet>




$ saxon9 box.xml box.xsl
<?xml version="1.0" encoding="UTF-8"?>
<box><!--box1_start--><title>1_boxtitle_h1</title>
   <subtitle>1_boxtitle_h2</subtitle>
   <para>boxpara</para>
</box>
<box><!--box2_start--><title>2_boxtitle_h1</title>
   <subtitle>2_boxtitle_h2</subtitle>
   <para>boxpara</para>
</box>

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Current Thread