|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
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








