[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Generating a CSV file using XSLT

Subject: Generating a CSV file using XSLT
From: "Ian Vaughan" <i.vaughan@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 9 Feb 2005 11:10:20 -0000
buildingrecord
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.