xsl-list
[Top] [All Lists]

RE: howto add elements to sections of xml document

2004-03-08 10:14:03
-----Original Message-----
From: John Mason

I would like to tranform the following xml:


Hi,

Try something like:

<xsl:stylesheet ..>
...
<xsl:key name="para-by-title" match="para" use="preceding-sibling::title[1]"
/>

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

<xsl:template match="section">
  <xsl:copy>
    <xsl:apply-templates select="title" />
  </xsl:copy>
</xsl:template>

<xsl:template match="title">
  <sub-section>
    <xsl:copy-of select="." />
    <xsl:copy-of select="key('para-by-title',.)" />
  </sub-section>
</xsl:template>


Hope this helps!

Cheers,

Andreas


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>