|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XML Comma Delimited Info to an HTML Table
Hi,
I only want to point out the "technique". You can use recursive
call-templates like the following one:
<xsl:template match="Record">
<tr>
<xsl:call-template name="divide">
<xsl:with-param name="to-be-divided" select="."/>
<xsl:with-param name="delimiter" select="';'"/>
</xsl:call-template>
</tr>
</xsl:template>
<xsl:template name="divide">
<xsl:param name="to-be-divided"/>
<xsl:param name="delimiter"/>
<xsl:choose>
<xsl:when test="contains($to-be-divided,$delimiter)">
<td><xsl:value-of
select="substring-before($to-be-divided,$delimiter)"/></td>
<xsl:call-template name="divide">
<xsl:with-param name="to-be-divided"
select="substring-after($to-be-divided,$delimiter)"/>
<xsl:with-param name="delimiter" select="';'"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<td><xsl:value-of select="$to-be-divided"/></td>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
It's not tested, but similar to this it should work.
Joerg
----- Original Message -----
From: <Surangi.Sharma@xxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, October 11, 2001 11:42 PM
Subject: XML Comma Delimited Info to an HTML Table
> This email is to be read subject to the disclaimer below.
>
> Comma Delimited Output to an HTML Table
>
> Hi,
> I have an XML file containing data corresponding to a table (see below).
> The first <Record> contains the column headings and the subsequent Records
> contain the row data (comma delimited). I am working on an XSLT to
> transform this XML message into an HTML format for a nice crisp display.
> Without re-inventing the wheel, is there any known solution in producing
an
> HTML table out of this?
>
> <Data>
> <Record>Full Name, Address1, Address2, Address3, Phone Number, Age,
> Hobby</Record>
> <Record>Anne Brown, 25A Symonds St, , Auckland, 09373535, 29,
> Reading</Record>
> <Record>Mark Smith, 30 Whiteney St, Blockhouse Bay, Auckland, 09
> 6232653, 31, Swimming</Record>
> <Record>Dane Anderson ,1 Crescent Dr, Newton, Auckland, 09373995, 20,
> </Record>
> ...
> </Data>
>
> Your help is much appreciated...
>
> cheers!!
> SS
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








