Hi, Attached are the sample xml/xsl/cfm files. I am getting the following error when I tried to open TransformXML.cfm using IE.
The XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. End tag was not expected at this location. Error processing resource 'http://localhost/XmlExampleCode/TransformXml.cfm'. Line 4, Position 3 </td></td></td></th></th></th></tr></tr></tr></table></table></table></a></abbrev></acronym></address></applet></au></b></banner></big></blink></blockquote></bq></caption></center></cite></code></comment></del></dfn></dir></div></div></dl></em></fig></fn></font></form></frame></frameset></h1></h2></h3></h4></h5></h6></head></i></ins></kbd></listing></map></marquee></menu></multicol></nobr></noframes></noscript></note></ol></p></param></person></plaintext></pre></q></s></samp></script></select></small></strike></strong></sub></sup></table></td></textarea></th></title></tr></tt></u></ul></var></wbr></xmp> --^ TransfomrXML.cfm file: <CFSET MyXmlFile = ExpandPath("Company.xml")> <!--- Read XML file into string variable called MyXmlCode ---> <CFFILE ACTION="READ" FILE="#MyXmlFile#" VARIABLE="MyXmlCode"> <CFSET MyStylesheet = ExpandPath("TransformCompany.xsl")> <!--- Read XSLT file into string variable called MyXsltCode ---> <CFFILE ACTION="READ" FILE="#MyStylesheet#" VARIABLE="MyXsltCode"> <!--- Perform the XSLT Stylesheet transformation ---> <CFSET TransformedXmlCode = XmlTransform(MyXmlCode, MyXsltCode)> <!--- Return transformed XML to whatever program asked for it ---> <CFCONTENT TYPE="text/plain" RESET="Yes"><CFOUTPUT>#TransformedXmlCode#</CFOUTPUT> Company.xml file: <?xml version="1.0" encoding="UTF-8"?> <company name="Macromedia"> <location name="Newton"> <employees> <person>Demi Moore</person> <person>Bruce Willis</person> </employees> </location> <location name="San Francisco"> <employees> <person>Tom Cruise</person> <person>Ben Forta</person> <person>Nicole Kidman</person> </employees> </location> </company> TransformCompany.xsl file: <?xml version="1.0" encoding="utf-8"?> <!-- Begin XSLT Stylesheet --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- This "template" runs on the data in the root <company> element --> <xsl:template match="/company"> <!-- This will become the root element in the transformed document --> <whos-who-in-hollywood> <!-- Now, for each <person> element in original XML... --> <xsl:for-each select="location/employees/person"> <!-- ...we'll "output" a <celebrity> tag in tranformed document --> <celebrity> <name first="{substring-before(., ' ')}" last="{substring-after(., ' ')}"/> <employer><xsl:value-of select="/company/@name"/></employer> <hometown><xsl:value-of select="../../@name"/></hometown> </celebrity> </xsl:for-each> <!-- Here's the end of our transformed document --> </whos-who-in-hollywood> </xsl:template> </xsl:stylesheet> Any help is greatly appreciated. Thanking you in advance. Mathy -----------------------+ cf-xml mailing list http://torchbox.com/xml/list.cfm
