[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: "Kielen, Agnes" <Agnes.Kielen@xxxxxxxxxxxxxx>
Date: Wed, 19 May 2004 08:22:41 +0200
span align
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

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.