|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: howto add elements to sections of xml document
> -----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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








