ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sean Tiley" <>
Subject RE: csv to html via xslt or xslt2 task ?
Date Tue, 11 Mar 2008 15:21:41 GMT
Hi there,
I am new to XSLT but saw your post and decided to attempt a solution,
mainly as an exercise for myself.

The responses you have received have better solutions than this one, but
I offer a novice's solution, which is neither elegant or flexible

(sorry for the formatting)

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl=""
    <xsl:output indent="yes"/>
    <!-- file location-->
    <xsl:variable name="in" 
    <xsl:template name="initial" match="/">
        <xsl:element name="values">
            <!-- Iterate through the lines in the file -->
            <xsl:for-each select="tokenize($in,'\r\n')">
                <xsl:variable name="line" select="."/>
                    Analyze the entire line and break into captured
                    (by using ( ) around the individual pieces  
                <xsl:analyze-string select="$line"
                        <xsl:element name="line">
                             This just puts out the line, was included
for testing purposed
                            <xsl:element name="RawData">
                              <xsl:value-of select="regex-group(0)"/>
                            <xsl:element name="Column1">
                                <xsl:value-of select="regex-group(1)"/>
                            <xsl:element name="Column2">
                                <xsl:value-of select="regex-group(2)"/>
                            <xsl:element name="Column3">
                                <xsl:value-of select="regex-group(3)"/>
                            <xsl:element name="Column4">
                                <xsl:value-of select="regex-group(4)"/>
                            <xsl:element name="Column5">
                                <xsl:value-of select="regex-group(5)"/>
                            <xsl:element name="Column6">
                                <xsl:value-of select="regex-group(6)"/>
                            <xsl:element name="Column7">
                                <xsl:value-of select="regex-group(7)"/>
                            <xsl:element name="Column8">
                                <xsl:value-of select="regex-group(8)"/>
                        <xsl:element name="UnmatchedInputLines">
                            <xsl:value-of select="."/>

-----Original Message-----
From: Z W [] 
Sent: Thursday, March 06, 2008 6:17 PM
To: Ant Users List
Subject: csv to html via xslt or xslt2 task ?

Hi ppl,

I have a few rows of comma delimited csv file.





and I like to transform it into html with xslt or xslt2.  Is that
possible ?

Could someone provide a simple example to manipulate 2 field in a
? I'm new to this hence

such a question.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message