xsl-list
[Top] [All Lists]

Generating a CSV file using XSLT

2005-02-09 04:10:20
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>

--~------------------------------------------------------------------
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>
--~--