Don
> On Tue, 2004-02-17 at 08:05, Chunshen Li wrote:
> > I now believe both CFX_XSLT tag and MM's XmlTranform tag work, it's
> just that late last night, sort of new to this thing + late night
> (couldn't think straight), the URL I was using last night was invalid,
> and I failed to debug to see if the CFHTTP call is successful.
> >
> > Now,
> >
> > CF script (url.releaseID value is given by a previous link, which is
> ok)
> > <cfhttp URL=""> > asp?compid=132066&reqtype=newsreleases&reqid=#URL.releaseID#">
> >
> > <cffile action="" file="C:\intel\wrt\ccbn\xsl\PressReleaseText.
> xsl" variable="ccbnxsl">
> >
> > debug:<br>
> > <cfoutput>Length of raw data: #Len(cfhttp.FileContent)# <p>
> > raw data:<br>
> > #cfhttp.FileContent#
> > </cfoutput>
> > <p>
>
> > xml transformed HTML output below:<br>
> > <cfoutput>"#xmltransform(cfhttp.FileContent,ccbnxsl)#"</cfoutput>
>
> Careful here you might want to trim() the file, and I think (depending
> on your version of MX)
> you have to xmltransform(XMLParse(cfhttp.FileContent),ccbnxsl)
>
> > XSL file:
> >
<!--''''''''''''> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> > INCLUDES
> >
''''''''''''''''> ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''-->
> > <xsl:include href=""> > >
> >
<!--''''''''''''> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> > OUTPUT MEHTOD
> >
''''''''''''''''> ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''-->
> > <xsl:output method="html" omit-xml-declaration="yes" indent="yes"
> standalone="no"/>
> >
> >
<!--'''''''''''''> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> > MAIN TEMPLATE
> >
''''''''''''''''> ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''-->
> > <xsl:template match="/">
> > <xsl:call-template name="GeneratePressReleaseText"/>
> <!--page-level template-->
> > </xsl:template>
> >
> >
<!--''''''''''''> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> >
> >
''''''''''''''''> ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''-->
> > <xsl:template name="GeneratePressReleaseText">
> > <table width="100%" border="0" cellpadding="3" cellspacing="1">
> > <tr class="modBgTblTtl">
> > <td valign="top" class="modTblTtl"><xsl:value-of
> select="/*/NewsReleaseText/Title"/></td>
> > </tr>
> > <tr class="">
> > <td valign="top" width="100%" class="modBodyText"><xsl:value-of
> select="/*/NewsReleaseText/ReleaseText"
> disable-output-escaping="yes"/></td>
> > </tr>
> > </table>
> > </xsl:template>
> >
> >
<!--''''''''''''> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> >
> >
''''''''''''''''> ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''-->
> > </xsl:stylesheet>
>
> If this is the full XSL file, then you are correct, the file is broken.
>
> It's not a full XML document.
Here is another included XSL file from the above one (please advise if I can provide a more readable copy):
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ccbnxml="http://xml.corporate-ir.net" exclude-result-prefixes="xsl xmlns ccbnxml">
<!--'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''-->
<xsl:template name="DisplayDate">
<xsl:param name="strDate"/>
<!--strDate is assumed to be in yyyymmdd format-->
<!--year parse-->
<xsl:variable name="strYear" select="substring($strDate,1,4)"/>
<!--month parse and string map-->
<xsl:variable name="intMonth">
<xsl:value-of select="substring($strDate,5,2)"/>
</xsl:variable>
<xsl:variable name="strMonth">
<xsl:if test="$intMonth='01'">Jan</xsl:if>
<xsl:if test="$intMonth='02'">Feb</xsl:if>
<xsl:if test="$intMonth='03'">Mar</xsl:if>
<xsl:if test="$intMonth='04'">Apr</xsl:if>
<xsl:if test="$intMonth='05'">May</xsl:if>
<xsl:if test="$intMonth='06'">Jun</xsl:if>
<xsl:if test="$intMonth='07'">Jul</xsl:if>
<xsl:if test="$intMonth='08'">Aug</xsl:if>
<xsl:if test="$intMonth='09'">Sep</xsl:if>
<xsl:if test="$intMonth='10'">Oct</xsl:if>
<xsl:if test="$intMonth='11'">Nov</xsl:if>
<xsl:if test="$intMonth='12'">Dec</xsl:if>
</xsl:variable>
<!--day parse and remove trailing 0 if applicable-->
<xsl:variable name="strDay">
<xsl:choose>
<xsl:when test="substring($strDate,7,1) = '0'"><xsl:value-of select="substring($strDate,8,1)"/></xsl:when>
<xsl:otherwise><xsl:value-of select="substring($strDate,7,2)"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!--display date as Dec. mm, YYYY-->
<xsl:value-of select="concat($strMonth,'. ',$strDay,', ',$strYear)"/>
</xsl:template>
<!--'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''-->
<xsl:template name="DisplayTime">
<xsl:param name="strTime"/>
<!--strTime is assumed to be in 00:00:00 format-->
<xsl:if test="string-length($strTime) > 0">
<!--hour parse-->
<xsl:variable name="intHour" select="substring($strTime,1,2)"/>
<!--minute parse-->
<xsl:variable name="intMinute" select="substring($strTime, 4,2)"/>
<!--display time-->
<xsl:choose>
<xsl:when test="number($intHour) < 12">
<xsl:variable name="strHour">
<xsl:choose>
<xsl:when test="number($intHour) < 10"><xsl:value-of select="substring($intHour, 2, 1)"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$intHour"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="concat($strHour, ':', $intMinute, ' AM')"/>
</xsl:when>
<xsl:when test="number($intHour) = 12">
<xsl:value-of select="concat($intHour, ':', $intMinute, ' PM')"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="intNonMilitaryHour" select="number($intHour) - 12"/>
<xsl:variable name="strHour">
<xsl:choose>
<xsl:when test="number($intNonMilitaryHour) < 10"><xsl:value-of select="substring(string($intNonMilitaryHour), 1, 1)"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$intNonMilitaryHour"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="concat($strHour, ':', $intMinute, ' PM')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
>
> >
> > UA Results:
> > IE6 failed to dispaly, Netscape6 display cfhttp call raw data, but
> xml transformed HTML nothing
> >
> > I sort of suspect the XSL file is culprit. Further thought? Thanks.
>
>
> Try this just to see if all is well. I am just writing this so there
> might be errors (I have not run it through cf)
>
> <!--- basic xslt --->
>
> <!--- note the <? must be the first thing in the file / variable --->
> <cfsavecontent variable="xmlinput"><?xml version="1.0"
> encoding="UTF-8"?>
> <test>
> <message>Eat at joes!</message>
> </test>
> </cfsavecontent>
>
> <!--- note the <? must be the first thing in the file / variable --->
> <cfsavecontent variable="xsltinput"><?xml version="1.0"
> encoding="utf-8"?>
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="html" indent="yes" encoding="UTF-8"/>
> <xsl:template match="/">
> <h2><xsl:value-of select="/test/message" /></h2>
> </xsl:template>
> </xsl:stylesheet>
> </cfsavecontent>
>
> <cfdump var="#xmlinput#">
> <cfdump var="#xsltinput#">
>
>
> <!--- try both of these --->
> <cfdump var="#XmlTransform(XmlParse(xmlinput),xsltinput)#">
> <!--- <cfdump var="#XmlTransform(xmlinput,xsltinput)#"> --->
>
> <!--- basic xslt --->
I tried both and both displayed XML content.
Many thanks.
> --
> Vale,
> Rob
>
> Luxuria immodica insaniam creat.
> Sanam formam viatae conservate!
>
> http://www.rohanclan.com
> http://treebeard.sourceforge.net
> http://ashpool.sourceforge.net
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

