[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

Subject: Re: XML Comma Delimited Info to an HTML Table
From: Jörg Heinicke <joerg.heinicke@xxxxxx>
Date: Fri, 12 Oct 2001 01:53:57 +0200
xslt comma delimited
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


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.