The data in the XML does not contain quotes it just contains a comma on
some fields such as
Bank,Street
Which is interfering with the following XSLT
<xsl:template match="BuildingRecord//* | apd:*/* ">
<xsl:if test="position() > 1 ">,</xsl:if>
<xsl:value-of select="normalize-space(.)"/> </xsl:template>
And instead of Bank, Street being entered under Address 1 it is split.
So Bank goes under Address 1 and Street under Address 2 which corrupts
layout of the generated CSV file
-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com]
Sent: 17 February 2005 09:17
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] XSLT and comma's in XML data
CSV files unfortunately have many conventions but no standards. One of
the conventions is that when a field contains a comma, you put the field
in quotes. I've no idea what you are supposed to do if the field also
contains quotes. It would probably be a good idea to do some experiments
with the software that's expected to read this CSV file.
It probably does no harm to put the field in quotes unconditionally: I
assume you can tackle that on your own.
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: Ian Vaughan
[mailto:i(_dot_)vaughan(_at_)neath-porttalbot(_dot_)gov(_dot_)uk]
Sent: 17 February 2005 09:02
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] XSLT and comma's in XML data
I am having a problem with my XML a snippet of which is shown below
<PropertyAddress>
<apd:A_5LineAddress>
<apd:Line>Bank, Street</apd:Line>
<apd:Line />
<apd:Line />
<apd:Line>Town</apd:Line>
<apd:PostCode></apd:PostCode>
</apd:A_5LineAddress>
</PropertyAddress>
...........................etc
The problem I am finding is that in the XML some fields such as
<apd:Line> sometimes has data that contains a comma such as
'Bank,Street'
Then when parsing this through the XSLT it is locating the comma
seperating 'Bank,Street' and splitting up the data
Any ideas on a solution would be most helpful
This is the XSLT
----------------------------------------------------------
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:apd="http://www.govtalk.gov.uk/people/AddressAndPersonal
Details">
<xsl:output method="text" />
<xsl:template match="/">
<xsl:text>UniqueRecordID, RegistrationNumber, RegisteredName,
Address1, Address2, Address3, Address4,PostCode, DateComplete,
DescriptionOfWorkItems </xsl:text> <xsl:apply-templates
select="//BuildingRecord"/> </xsl:template>
<xsl:template match="BuildingRecord">
<xsl:text> </xsl:text>
<xsl:apply-templates select=".//*[not(*)] | .//apd:*/*"/>
</xsl:template>
<xsl:template match="BuildingRecord//* | apd:*/* "> <xsl:if
test="position() > 1 ">,</xsl:if> <xsl:value-of
select="normalize-space(.)"/> </xsl:template>
</xsl:stylesheet>
-----------------------------------------------------------
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--