Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   XML to CSV Problem (http://www.velocityreviews.com/forums/t168626-xml-to-csv-problem.html)

rosemm 01-20-2005 06:26 PM

XML to CSV Problem
 
Hi,

I am having a problem with a conversion program I am writing to change
XML to a CSV. The biggest problem is I can't figure out how to get all
the text for one record on a single line without having one really
really long line of code like this:

<xsl:value-of select="NAME/LAST/@VALUE"/>,<xsl:value-of
select="NAME/FIRST/@VALUE"/>,<xsl:value-of
select="NAME/MIDDLE//@VALUE"/>,<xsl:value-of
select="CITY_OF_BIRTH/@VALUE"/>,<xsl:value-of
select="BIRTH_DATE/@VALUE"/><xsl:text> </xsl:text>

Yes that is just one line of code! The problem is that this is like
1/10 of the data I have for every record plus I need to do
manipulations on the data. Does anyone have any idea how I can have
each separate piece of data on a different line and end up with all of
one record on the same line?


Martin Honnen 01-20-2005 06:53 PM

Re: XML to CSV Problem
 


rosemm wrote:


> I am having a problem with a conversion program I am writing to change
> XML to a CSV. The biggest problem is I can't figure out how to get all
> the text for one record on a single line without having one really
> really long line of code like this:
>
> <xsl:value-of select="NAME/LAST/@VALUE"/>,<xsl:value-of
> select="NAME/FIRST/@VALUE"/>,<xsl:value-of
> select="NAME/MIDDLE//@VALUE"/>,<xsl:value-of
> select="CITY_OF_BIRTH/@VALUE"/>,<xsl:value-of
> select="BIRTH_DATE/@VALUE"/><xsl:text> </xsl:text>
>
> Yes that is just one line of code! The problem is that this is like
> 1/10 of the data I have for every record plus I need to do
> manipulations on the data. Does anyone have any idea how I can have
> each separate piece of data on a different line and end up with all of
> one record on the same line?


Try to use <xsl:text> to have your literal text output e.g.
<xsl:template match="/">
<xsl:value-of select="NAME/LAST/@VALUE" />
<xsl:text>,</xsl:text>
<xsl:value-of select="NAME/FIRST/@VALUE" />
<xsl:text>,</xsl:text>
</xsl:template>


--

Martin Honnen
http://JavaScript.FAQTs.com/

=?ISO-8859-1?Q?J=FCrgen_Kahrs?= 01-20-2005 07:38 PM

Re: XML to CSV Problem
 
rosemm wrote:

> I am having a problem with a conversion program I am writing to change
> XML to a CSV. The biggest problem is I can't figure out how to get all


For such simple conversions XSLT is overkill.

> manipulations on the data. Does anyone have any idea how I can have
> each separate piece of data on a different line and end up with all of
> one record on the same line?


Is XSLT a *must* or are you free to choose a
more suitable tool ?

Andy Dingley 01-21-2005 03:13 PM

Re: XML to CSV Problem
 
On Thu, 20 Jan 2005 20:38:37 +0100, Jürgen Kahrs
<Juergen.KahrsDELETETHIS@vr-web.de> wrote:

>For such simple conversions XSLT is overkill.


If the convenient tool you have is Xalan/Xerces, then everything looks
like an XSLT problem.

I just wouldn't worry about the long "lines", or line-break things
before the closing > of a tag if you have to. XSLT source code just
is somewhat ugly for human-readability.
--
Smert' spamionam


All times are GMT. The time now is 01:39 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.