Hi all,

I am new to the list and wonderfully enjoying and exploring CML and CF.
However I have an issue that perhaps some light can be shed upon?

I am trying to figure out some of the nuances of using XMLSearch and
XMLTransform. I hope some one can lend some advise. Here is an overview of
what I am trying to do.

XML FILE

<?xml version="1.0" encoding="UTF-8"?>

<quote>

<day value="Sunday">
<text>This is a test Sun</text>
<who>I said this</who>
<datesaid>I said it on</datesaid>
</day>

<day value="Monday">
<text>This is a test - Mon</text>
<who>I said this</who>
<datesaid>I said it on</datesaid>
</day>

<day value="Tuesday">
<text>This is a test Tues</text>
<who>I said this</who>
<datesaid>I said it on</datesaid>
</day>

<day value="Wednesday">
<text>This is a test Wed</text>
<who>I said this</who>
<datesaid>I said it on</datesaid>
</day>

<day value="Thursday">
<text>This is a test Thurs</text>
<who>I said this</who>
<datesaid>I said it on</datesaid>
</day>

<day value="Friday">
<text>This is a test Fri</text>
<who>I said this</who>
<datesaid>I said it on</datesaid>
</day>

<day value="Saturday">
<text>This is a test Sat</text>
<who>I said this</who>
<datesaid>I said it on</datesaid>
</day>

</quote>


XSL FILE

<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
<xsl:template match="/">
<strong><xsl:value-of select="quote/day/text"/></strong>
<xsl:value-of select="quote/day/who"/>
<xsl:value-of select="quote/day/datesaid"/>
</xsl:template>
</xsl:stylesheet>



Cold Fusion File

<cfoutput>

<cffile action="READ" file="#request.RootDir#_shared_\quote.xml"
variable="XMLQuote">
<cffile action="READ" file="#request.RootDir#_shared_\quote.xsl"
variable="QuoteStyle">

<!--- Get the XML --->
<cfset GetQuote = xmlparse(XMLQuote)>
<!--- Get the Root --->
<cfset QuoteRoot = GetQuote.XMLRoot>
<!--- Get # of Children --->
<cfset NChildren = ArrayLen(QuoteRoot.XmlChildren)>

<cfset RightNow = '#dateformat(now(),"dddd")#'>

<!--- Get Only Today --->
<cfset QuoteDay = XMLSearch(GetQuote, "//*[@value='#RightNow#']")>


<img src="../_gfx_/header/quote_of_day.gif" alt="" width="126" height="16"
border="0"><table width="150" border="1" cellspacing="0" cellpadding="4"
align="center" bordercolor="FFFFFF">
<tr>
<td bgcolor="336699" class="lightSmall">

<cfloop from="1" to="#ArrayLen(QuoteDay)#" index="i">
<cfset XMLLoop = #QuoteDay.XMLText#>
<!--- <cfset TransformedXML = xmlTransform(XMLLoop, QuoteStyle)>
#TransformedXML# --->
#XMLLoop#
</cfloop>



</td>
</tr>
</table>


</cfoutput>

What I keep on getting is the error:


org.xml.sax.SAXParseException: Document root element is missing.
org.xml.sax.SAXParseException: Document root element is missing.
The error occurred on line 25.


Regards,
Michael

http://www.foureyes.com




-----------------------+
cf-xml mailing list
http://torchbox.com/xml/list.cfm

Reply via email to