|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: attributes to nested element problem
Hi Tim,
Something like this maybe. I'm sure it can be made smarter.
Cheers,
Agnes
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/label">
<xsl:apply-templates select="@paragraph"/>
</xsl:template>
<xsl:template match="@paragraph">
<xsl:choose>
<xsl:when test=".='true'">
<p><xsl:apply-templates select="../@align"/></p>
</xsl:when>
<xsl:otherwise><xsl:apply-templates select="../@align"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="@align">
<span align="{.}">
<xsl:apply-templates select="../@italic"/>
</span>
</xsl:template>
<xsl:template match="@italic">
<xsl:choose>
<xsl:when test=".='true'">
<i><xsl:apply-templates select="../@bold"/></i>
</xsl:when>
<xsl:otherwise><xsl:apply-templates select="../@bold"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="@bold">
<xsl:choose>
<xsl:when test=".='true'">
<b><xsl:value-of select=".."/></b>
</xsl:when>
<xsl:otherwise><xsl:value-of select=".."/></xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
-----Original Message-----
From: Tim Lord [mailto:timl@xxxxxxxxxxx]
Sent: woensdag 19 mei 2004 7: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
|
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








