Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help !

Status
Not open for further replies.

Sarky78

Programmer
Oct 19, 2000
878
GB
Right then I have got a XML file that looks like this:

<?xml version=&quot;1.0&quot;?>
<fixtures>
<Game>
<GameID>78</GameID>
<GameDate>2001-08-29 19:35:00</GameDate>
<TeamA>A Team</TeamA>
<TeamAScore>0</TeamAScore>
<TeamB>B Team</TeamB>
<TeamBScore>0</TeamBScore>
</Game>
.
.
.
.

</fixtures>

I need to convert this into a WDDX format for a web language (Coldfusion) to read and then to write to a database. I am trying to get this information into the following format:

<field name='FIXTUREID'><number>78</number><number>79</number><number>80</number><number>81</number><number>82</number></field>

etc etc

I have got a XSL sheet that I have attempted to do this, but i comes out in the same format as the actual xml document, is this meant to happen, is there any way of getting around this?

This is the xsl that i have got:

<xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;
<xsl:template match=&quot;/&quot;>
<wddxPacket version=&quot;1.0&quot;>
<header>
<data>
<recordset fieldNames='GameID,GameDate,TeamA,TeamAScore,TeamB,TeamBScore'>
<xsl:apply-templates/>
</recordset>
</data>
</header>
</wddxPacket>
</xsl:template>

<xsl:template match=&quot;GameID&quot;>
<field name=&quot;{name(.)}&quot;>
<number>
<xsl:value-of select=&quot;text()&quot;/>
</number>
</field>
</xsl:template>

<xsl:template match=&quot;TeamA&quot;>
<field name=&quot;{name(.)}&quot;>
<string>
<xsl:value-of select=&quot;text()&quot;/>
</string>
</field>
</xsl:template>

<xsl:template match=&quot;TeamAScore&quot;>
<field name=&quot;{name(.)}&quot;>
<number>
<xsl:value-of select=&quot;text()&quot;/>
</number>
</field>
</xsl:template>

<xsl:template match=&quot;TeamB&quot;>
<field name=&quot;{name(.)}&quot;>
<string>
<xsl:value-of select=&quot;text()&quot;/>
</string>
</field>
</xsl:template>

<xsl:template match=&quot;TeamBScore&quot;>
<field name=&quot;{name(.)}&quot;>
<number>
<xsl:value-of select=&quot;text()&quot;/>
</number>
</field>
</xsl:template>

<xsl:template match=&quot;GameDate&quot;>
<field name=&quot;{name(.)}&quot;>
<dateTime>
<xsl:value-of select=&quot;text()&quot;/>
</dateTime>
</field>
</xsl:template>

</xsl:stylesheet>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top