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

[xsl] Generating a CSV file using XSLT


Subject: [xsl] Generating a CSV file using XSLT
From: "Ian Vaughan" <i.vaughan@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 9 Feb 2005 11:10:20 -0000

Hi

I am after some help so I can complete this XSL document.  I am trying
to transform the following XML document into a comma seperated .CSV
file.

However my XSL is only returning one item in the DescriptionofWorkItem
when it should return 3 pieces of information as shown in the example
XML doc below. ?

Also the address is coming back as one long string of text i.e. Street
NameTownSA128JW   ???

How could I seperate the address results ?


This is what I have for my .XSL
-------------------------------------------------

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 version="1.0">
<xsl:output method="text"/>

<xsl:template match="BuildingRecord">
<xsl:value-of select="normalize-space(SchemeUniqueRecordIdentifier)"/>,
<xsl:value-of
select="normalize-space(CompetentPerson/PersonRegistrationNumber)"/>,
<xsl:value-of
select="normalize-space(CompetentPerson/InstallerRegisteredName)"/>,
<xsl:value-of
select="normalize-space(WorkPerformed/PropertyInformation/PropertyLocati
on/PropertyAddress/)"/>,
<xsl:value-of
select="normalize-space(WorkPerformed/DateWorkCompleted)"/>,
<xsl:value-of
select="normalize-space(WorkPerformed/DescriptionOfWorkItem)"/>,
</xsl:template>
</xsl:stylesheet>
------------------------------------------------------


This is a snippet of my XML doc
----------------------------------------------------------
<?xml version="1.0" encoding="UTF-16" ?>
<BuildingRecordSet xmlns:rs="urn:schemas-microsoft-com:rowset"
xmlns:z="#RowsetSchema"
xmlns:apd="http://www.govtalk.gov.uk/people/AddressAndPersonalDetails">

<SchemeName>DATA</SchemeName>
<LocalAuthorityCode>DATA</LocalAuthorityCode>

    <BuildingRecord>
        <SchemeUniqueRecordIdentifier>2</SchemeUniqueRecordIdentifier>
        <CompetentPerson>
            <PersonRegistrationNumber>02</PersonRegistrationNumber>
            <InstallerRegisteredName>Name</InstallerRegisteredName>
        </CompetentPerson>

        <WorkPerformed>
            <PropertyInformation>
                <PropertyLocation>
                    <PropertyAddress>
                        <apd:A_5LineAddress>
                            <apd:Line>Street Name</apd:Line>
                            <apd:Line />
                            <apd:Line />
                            <apd:Line>Town</apd:Line>
                            <apd:PostCode>SA128JW</apd:PostCode>
                        </apd:A_5LineAddress>
                    </PropertyAddress>
                </PropertyLocation>
            </PropertyInformation>
            <DateWorkCompleted>20/01/2005</DateWorkCompleted>
            <DescriptionOfWorkItem>Shower</DescriptionOfWorkItem>
             <DescriptionOfWorkItem>New Unit</DescriptionOfWorkItem>
        </WorkPerformed>
    </BuildingRecord>

    <BuildingRecord> ...............etc

</buildingrecordset>


Current Thread
Keywords