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

RE: attributes to nested element problem

Subject: RE: attributes to nested element problem
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 19 May 2004 09:05:25 +0100
span align
There's a nice 2.0 solution:

<xsl:template match="*[@paragraph='true']" priority="4">
<p>
  <xsl:next-match/>
</p>
</xsl:template>

<xsl:template match="*[@align]" priority="3">
<span align="{@align}">
  <xsl:next-match/>
</span>
</xsl:template>

<xsl:template match="*[@italic='true']" priority="2">
<i>
  <xsl:next-match/>
</i>
</xsl:template>

<xsl:template match="*[@bold='true']" priority="1">
<b>
  <xsl:next-match/>
</b>
</xsl:template>

You can do the same with xsl:apply-imports in 1.0 but it requires a separate
stylesheet module for each rule.

Michael Kay

 

> -----Original Message-----
> From: Tim Lord [mailto:timl@xxxxxxxxxxx] 
> Sent: 19 May 2004 05:36
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  attributes to nested element problem
> 
> Hi,
> 
> I was wondering how to convert an element:
> 
> <label align="left" paragraph="true" italic="true" 
> bold="true">This is a 
> label</label>
> 
> Into this html:
> 
> <p><span align="left"><b><i>This is a label</i></b></span></p>
> 
> I found solutions to converting attributes to elements but what about 
> nested elements like this?
> 
> Cheers,
> 
> /tim

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.