Re: [xsl] attributes to nested element problem

Subject: Re: [xsl] attributes to nested element problem
From: Tim Lord <timl@xxxxxxxxxxx>
Date: Thu, 20 May 2004 10:50:32 +1200
Thanks for all your quick responses! I was grappling with this for a while yesterday... a lot more difficult than I would have thought... Wendall I'll have to study your one a bit to get my head around it... and I guess I'll have to wait for 2.0 for the nicer solution.... thanks again!


Michael Kay wrote:

There's a nice 2.0 solution:

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

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

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

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

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: [xsl] attributes to nested element problem


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?



Current Thread