[xquery-talk] XSL Question
Rajashekaraiah, Rashmi (HP-IT)
rashmir at hp.com
Wed May 24 12:31:14 PDT 2006
Thanks a lot... It worked
-----Original Message-----
From: Raffaele Sena [mailto:raff at aromatic.org]
Sent: Wednesday, May 24, 2006 11:08 AM
To: Rajashekaraiah, Rashmi (HP-IT)
Cc: talk at xquery.com
Subject: Re: [xquery-talk] XSL Question
Call it like this
<xsl:template match="/">
<html><body><table><tr>
<xsl:call-template name="split">
<xsl:with-param name="input-string" select="root/child"/>
<xsl:with-param name="separator" select="','"/>
</xsl:call-template>
</tr></table></body></html>
</xsl:template>
-- Raffaele
Rajashekaraiah, Rashmi (HP-IT) wrote:
> Thanks, but in this where do I need to pass the //child
>
> <xsl:template name="split">
> <xsl:param name="input-string"/>
> <xsl:param name="separator"/>
>
> <xsl:if test="$input-string">
> <td><xsl:value-of
> select="substring-before($input-string, $separator)/></td>
> <xsl:call-template name="split">
> <xsl:with-param name="input-string"
> select="substring-after($input-string, $separator"/>
> <xsl:with-parma name="separator" select="$separator"/>
> </xsl:if>
> </xsl:template>
>
>
>
>
> -----Original Message-----
> From: Raffaele Sena [mailto:raff at aromatic.org]
> Sent: Wednesday, May 24, 2006 9:17 AM
> To: Rajashekaraiah, Rashmi (HP-IT)
> Cc: talk at xquery.com
> Subject: Re: [xquery-talk] XSL Question
>
>
> since you posted this on the xquery forum I am assuming you are
> talking about XPath 2.0 functionalities.
>
> With XPath 2.0 you can use the fn:tokenize() function to split your
> comma-separated list:
>
> fn:tokenize(//child, ',')
>
> returns
> ('name1', 'name2_pewe', 'name3')
>
> If you want to be XSLT 1.0 - XPath 1.0 compliant you can write a
> recursive function that uses fn:substring-before and
fn:substring-after:
>
> <xsl:template name="split">
> <xsl:param name="input-string"/>
> <xsl:param name="separator"/>
>
> <xsl:if test="$input-string">
> <td><xsl:value-of
> select="substring-before($input-string, $separator)/></td>
> <xsl:call-template name="split">
> <xsl:with-param name="input-string"
> select="substring-after($input-string, $separator"/>
> <xsl:with-parma name="separator" select="$separator"/>
> </xsl:if>
> </xsl:template>
>
> (I didn't really try this but it should be "almost" correct :)
>
> -- Raffaele
>
>
> Rajashekaraiah, Rashmi (HP-IT) wrote:
>
>>Hi :
>>
>>I have a XML which looks like :
>><root><child>name1,name2_pewe,name3</child></root>
>>
>>
>>I want to write an xsl to trasnform this to html which should look
>>like <html> <body> <table> <tr><td>name1<td><td></td><td></td><tr>
>></table>
>><body>
>></html>
>>
>>I dono how to write a split function in xslt. please help
>>
>>Thanks,
>>Rashmi
>>
>>
>>
>>
>>----------------------------------------------------------------------
>>--
>>
>>_______________________________________________
>>talk at xquery.com
>>http://xquery.com/mailman/listinfo/talk
>>
>>!DSPAM:4473c46a146357962374464!
>
>
> _______________________________________________
> talk at xquery.com
> http://xquery.com/mailman/listinfo/talk
>
>
> !DSPAM:4473d4f6150175753929526!
>
More information about the talk
mailing list