Hi,
I have an XML stream that I would like to convert to CSV file thru XSL
transformation. I use the following stylesheet, but the problem is it
only selects top elements within an 'Account' node and does not process
elements for 'Name' element.
Stylesheet:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:apply-templates select="//Account[1]"/>
</xsl:template>
<xsl:template match="Account">
<xsl:for-each select="*"><xsl:value-of select="."/><xsl:if test="last()
position()">,</xsl:if></xsl:for-each><xsl:text></xsl:text>
</xsl:template>
</xsl:stylesheet>
XML:
<?xml version="1.0"?>
<Data>
<Account>
<AccountNumber>1000748</AccountNumber>
<SequenceNo>1</SequenceNo>
<AccountBalance>1052.35</AccountBalance>
<Name>
<CitizenNameTitle>Mr</CitizenNameTitle>
<CitizenNameForename>Joe</CitizenNameForename>
<CitizenNameSurname>Bloggs</CitizenNameSurname>
</Name>
</Account>
</Data>
Output:
1000748,1,1052.35,MrJoeBloggs
I would appreciate any help in this matter.
Andrew