Massive headache with XmlTransform

Discussion in 'Programming' started by andylyon87, Nov 19, 2009.

  1. #1
    I have a huge headache.

    I have a file that reads a list from the database then it saves the list to a file, then the same file reads the list from the file and uses 'XmlTransform' to join it to the XSLT and format it.

    My problem is that the code I have used on that website simply doesn't work when I have replicated it to produce the code below, can anyone tell me any potential problems I might face using this, I have scoured the internet trying to find an answer and nothing makes any sense.

    Your help is much appreciated!

    
    <CFQUERY name="get_fixtures" datasource="*">
      SELECT Opposition, fdate, ftime, location 
      FROM fixtures
      ORDER BY fdate
    </CFQUERY>
    
    <?xml version="1.0"?>
    
    <CFXML VARIABLE="FixtureXml">
      <upcomingFixtures>
        <CFOUTPUT query="get_fixtures">
          <fixture>
            <fdate>#fdate#</fdate>
            <opposition>#Opposition#</opposition>
            <location>
              #location#
            </location>
            <ko>#ftime#</ko>
          </fixture>
         </CFOUTPUT>
      </upcomingFixtures>
    </CFXML>
    
    <CFFILE
    ACTION="WRITE"
    FILE="#ExpandPath('Fixturelist.xml')#"
    OUTPUT="#ToString(FixtureXml)#">
    
    
    
    <CFSET FixturList = ExpandPath("Fixturelist.xml")>
    <!--- Read XML file into string variable called MyXmlCode --->
    <CFFILE
    ACTION="READ"
    FILE="#FixturList#"
    VARIABLE="LFCFixtureList">
    <!--- You also need to work with your XSLT Stylesheet code --->
    <CFSET FixtureXSL = ExpandPath("fixtures.xsl")>
    <!--- Read XSLT file into string variable called MyXsltCode --->
    <CFFILE
    ACTION="READ"
    FILE="#FixtureXSL#"
    VARIABLE="LFCFixtureXSL">
    <!--- Perform the XSLT Stylesheet transformation --->
    <CFSET XSLXMLmesh = XmlTransform(LFCFixtureList, LFCFixtureXSL)>
    <!--- Return transformed XML to whatever program asked for it --->
    <CFCONTENT
    TYPE="text/html"
    RESET="Yes"><CFOUTPUT>#XSLXMLmesh#</CFOUTPUT>
    
    Code (markup):
    The file it writes to is being populated so I know the first portion works. I having problems with the latter part, if anyone knows what is happenin I would love your input.
     
    andylyon87, Nov 19, 2009 IP