xsl-list
[Top] [All Lists]

RE: attributes to nested element problem

2004-05-19 01:05:25
There's a nice 2.0 solution:

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

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

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

<xsl:template match="*[(_at_)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(_at_)treshna(_dot_)com] 
Sent: 19 May 2004 05:36
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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



--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--