[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Un-nesting elements in XSLT 2.0

Subject: Un-nesting elements in XSLT 2.0
From: "Tristan Stevens" <tristanstevens@xxxxxxxxxxx>
Date: Sat, 11 Nov 2006 00:01:25 -0000
tristan stevens
Hi,

I've got a problem that I've been pondering over and I'm sure there's a
pattern for doing this.
I have a hierarchical structure that I need to break out, but things seem to
get confusing when mixed content models come into play.

Example:

<para>
      This is some above image text<sup>See footnote 1</sup>
   <image src="image1.gif" alternative="My Image"/>
       This is some text in between the image and table.
   <table>
       <tr>
           <td>...
       ...
   </table>
       Some more text to finish the paragraph off.
</para>

I need to convert this into the following:

<p>This is some above image text <sup>See footnote 1</sup></p>
<img src="image1.gif alt="My Image"/>
<p>This is some text in between the image and table.</p>
<table>
   ...
</table>
<p>Some more text to finish the paragraph off.</p>


The way that you'd want to write your XSL would be something like:


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

<xsl:template match="image">
   </p>
       <img>
           <xsl:attribute...
           ...
       </img>
   <p>
</xsl:template>

but of course that is non-sensical.

What is the easiest and/or most efficient way to do this in XSLT 2.0?

Thanks

Tristan

**********************************************
Tristan Stevens


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.