|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: string manipulation
You need to use recursion. Something like the following might do it for
your attributes (warning: untested!):
<xsl:template match="/item">
<xsl:call-template name="print-att">
<xsl:with-param name="string" select="@key"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="print-att">
<xsl:param name="string"/>
<xsl:variable name="first" select="substring-before($string, ',')"/>
<xsl:if test="$first">
<xsl:value-of select="concat(' <-> ', $first"/>
<xsl:call-template name="print-att">
<xsl:with-param name="string" select="substring-after($string,
',')"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
On Fri, 2002-10-25 at 10:52, john liao wrote:
> Hi Listmembers,
>
> I'm finding myself having to manipulate strings
> because the tool that generates my xml can't generate
> new elements that I need:
>
> <item name="var1" description="subscribed
> key=att1,att2 corc=att2,att3,att4,att21,att25"/>
>
> I want to parse the description so I can print
> key: att1
> key: att2
> a: att2
> a: att3
> a: att4
> a: att21
> a: att25
>
> I can't figure it out using substring-before or
> substring-after. Your help is very much appreciated.
>
> J.L.
>
> =====
>
>
> __________________________________________________
> Do you Yahoo!?
> Y! Web Hosting - Let the expert host your web site
> http://webhosting.yahoo.com/
>
> 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








