Right then I have got a XML file that looks like this:
<?xml version="1.0"?>
<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="1.0" xmlns:xsl="
<xsl:template match="/">
<wddxPacket version="1.0">
<header>
<data>
<recordset fieldNames='GameID,GameDate,TeamA,TeamAScore,TeamB,TeamBScore'>
<xsl:apply-templates/>
</recordset>
</data>
</header>
</wddxPacket>
</xsl:template>
<xsl:template match="GameID">
<field name="{name(.)}">
<number>
<xsl:value-of select="text()"/>
</number>
</field>
</xsl:template>
<xsl:template match="TeamA">
<field name="{name(.)}">
<string>
<xsl:value-of select="text()"/>
</string>
</field>
</xsl:template>
<xsl:template match="TeamAScore">
<field name="{name(.)}">
<number>
<xsl:value-of select="text()"/>
</number>
</field>
</xsl:template>
<xsl:template match="TeamB">
<field name="{name(.)}">
<string>
<xsl:value-of select="text()"/>
</string>
</field>
</xsl:template>
<xsl:template match="TeamBScore">
<field name="{name(.)}">
<number>
<xsl:value-of select="text()"/>
</number>
</field>
</xsl:template>
<xsl:template match="GameDate">
<field name="{name(.)}">
<dateTime>
<xsl:value-of select="text()"/>
</dateTime>
</field>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0"?>
<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="1.0" xmlns:xsl="
<xsl:template match="/">
<wddxPacket version="1.0">
<header>
<data>
<recordset fieldNames='GameID,GameDate,TeamA,TeamAScore,TeamB,TeamBScore'>
<xsl:apply-templates/>
</recordset>
</data>
</header>
</wddxPacket>
</xsl:template>
<xsl:template match="GameID">
<field name="{name(.)}">
<number>
<xsl:value-of select="text()"/>
</number>
</field>
</xsl:template>
<xsl:template match="TeamA">
<field name="{name(.)}">
<string>
<xsl:value-of select="text()"/>
</string>
</field>
</xsl:template>
<xsl:template match="TeamAScore">
<field name="{name(.)}">
<number>
<xsl:value-of select="text()"/>
</number>
</field>
</xsl:template>
<xsl:template match="TeamB">
<field name="{name(.)}">
<string>
<xsl:value-of select="text()"/>
</string>
</field>
</xsl:template>
<xsl:template match="TeamBScore">
<field name="{name(.)}">
<number>
<xsl:value-of select="text()"/>
</number>
</field>
</xsl:template>
<xsl:template match="GameDate">
<field name="{name(.)}">
<dateTime>
<xsl:value-of select="text()"/>
</dateTime>
</field>
</xsl:template>
</xsl:stylesheet>