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

Re: need help with converting attribute into elements

Subject: Re: [xsl] need help with converting attribute into elements
From: Aleš Peregrin <ales.peregrin@xxxxxxxxxx>
Date: Tue, 14 Oct 2003 15:12:22 +0200
Re:  need help with converting attribute into elements
Hi,
thanx for another good approach. I didn't expect there are going to be so
many suportive people.
With such guys, learning something new is easy.

Ales


----- Original Message -----
From: "Jeff Beadle" <Jbeadle@xxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, October 14, 2003 2:29 PM
X-Scanned: By Symantec Anti-Virus Scan Engine
Subject: Re: [xsl] need help with converting attribute into elements


> Hey Ales,
>
> I'm coming into this thread a bit late, but here's an approach that has no
> conditional logic and should be easy to extend.
>
> This approach assumes that the order of the nesting doesn't matter ...
which
> with html's "b", "i", and "u" elements that's true.
>
> You build in the ordering logic--if needed--into the "the-list" variable.
>
>
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" exclude-result-prefixes="msxsl"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:msxsl="urn:schemas-microsoft-com:xslt">
>
> <xsl:template match="/">
> <xsl:apply-templates/>
> </xsl:template>
>
> <xsl:template match="text">
>    <xsl:variable name="the-list">
>       <xsl:for-each select="@*[.='true']">
>          <xsl:element name="{name()}"/>
>       </xsl:for-each>
>       <the-value><xsl:value-of select="."/></the-value>
>    </xsl:variable>
>    <font>
>       <xsl:apply-templates
select="msxsl:node-set($the-list)/child::*[1]"/>
>    </font>
> </xsl:template>
>
> <xsl:template match="bold">
>    <b>
>       <xsl:apply-templates select="following-sibling::*[1]"/>
>    </b>
> </xsl:template>
>
> <xsl:template match="italic">
>    <i>
>       <xsl:apply-templates select="following-sibling::*[1]"/>
>    </i>
> </xsl:template>
>
> <xsl:template match="underline">
>    <u>
>       <xsl:apply-templates select="following-sibling::*[1]"/>
>    </u>
> </xsl:template>
>
> <xsl:template match="the-value">
>    <xsl:apply-templates/>
> </xsl:template>
>
> </xsl:stylesheet>
>
>
> HTH,
> Jeff
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.