[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Generating a CSV file using XSLT


Subject: RE: [xsl] Generating a CSV file using XSLT
From: "Ian Vaughan" <i.vaughan@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 14 Feb 2005 10:17:24 -0000

Joris

Using your suggested code the output generated in the CSV file is as
follows, as you can see all the row headers and data are being displayed
on the same line, shown below

LA Code

NICEIC

UniqueRecordID  RegistrationNumber RegisteredName Address1 Address2
Address3 Address4 PostCode	 DateComplete DescriptionOfWorkItems
DescriptionOfWorkItems 24 2031  Name Street ..............etc

When it should look like what is shown below

LA Code DATA
<SPACE>
UniqueRecordID  RegistrationNumber RegisteredName Address1 Address2
Address3 Address4 PostCode	 DateComplete DescriptionOfWorkItems
24 2031  Name Street etc.

I have tried changing the XSLT but with no success..


Another problem I am finding is that in the XML if some of the fields
hold data such as  " House, House Name " then instead of that piece of
data being entered under Address 2, House goes under Address2 and House
Name goes into Address 3.  As it is finding the comma seperating House,
House Name and splitting up the data.

Any ideas on a solution would be most helpful

ian




-----Original Message-----
From: Joris Gillis [mailto:roac@xxxxxxxxxx]


> Joris
>
> I have added the following lines to the template to get the display to

> look like what is shown below with the LA Code hightlighting the data
> in SchemeName, however in the results it is not returning the
> SchemeName or the text LA Code ?? But it is returning the rest of the
information ??
>
> Can you see why this is the case from the code I have added ?

Yes you have to make sure the template is applied:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:apd="http://www.govtalk.gov.uk/people/AddressAndPersonalDetails">

<xsl:template match="BuildingRecordSet"> <xsl:apply-templates
select="SchemeName"/> <xsl:text>UniqueRecordID, RegistrationNumber,
RegisteredName, Address1, Address2, Address3, Address4,PostCode,
DateComplete, DescriptionOfWorkItems, DescriptionOfWorkItems </xsl:text>
<xsl:apply-templates select="BuildingRecord"/> </xsl:template>

<xsl:template match="SchemeName">
<xsl:text>LA Code
</xsl:text>
<xsl:apply-templates/>
<xsl:text>
</xsl:text>
</xsl:template>

<xsl:template match="BuildingRecord">
<xsl:apply-templates select=".//*[not(*)]  | .//apd:*/*"/> <xsl:text>
</xsl:text> </xsl:template>

<xsl:template match="BuildingRecord//* | apd:*/* "> <xsl:if
test="position() &gt; 1 ">,</xsl:if> <xsl:value-of
select="normalize-space(.)"/> </xsl:template>

</xsl:stylesheet>


regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
Veni, vidi, wiki (http://www.wikipedia.org)


Current Thread
Keywords