7 Replies Latest reply on Jul 20, 2006 8:33 AM by Newsgroup_User

    XSLT and CF help

    Level 7
      I'm trying to place an RSS feed in my home page. I've followed this Dev
      Center guide: http://tinyurl.com/ewbdv

      I've gotten everything to work perfectly locally. However, when I upload
      the files it won't work online here: http://tinyurl.com/ootyn

      The error I receive is:

      Could not find the ColdFusion Component
      burnettcom.includes.MM_XSLTransform.MM_XSLTransform.
      Please check that the given name is correct and that the component
      exists. The error occurred in
      C:\domains\burnettcom.com\wwwroot\home.cfm: line 28
      26 : <!--- XSL Transformation --->
      27 : <cfinvokeargument name="xml"
      value=" http://www.burnettcom.com/blog/?feed=rss2">
      28 : <cfinvokeargument name="xsl" value="headlines.xsl">
      29 : </cfinvoke></div><!---end posts--->


      Instead of the path burnettcom.includes.MM_XSLTransform.MM_XSLTransform.
      shouldn't it be burnettcom/includes/MM_XSLTransform/MM_XSLTransform.cfm

      This is the only thing that I can see that would be wrong.

      Can anyone help me to get this to work online?

      Thanks in advance.
        • 1. Re: XSLT and CF help
          Level 7
          Update: I've got it working online now. I've configured it to display
          the title and date for each post.

          The only problem is that the date appears as:

          Tue, 18 Jul 2006 04:38:07 +0000

          I would prefer the date to appear as:

          July 18, 2006

          or

          6.18.06

          Does anyone know how to make this work?
          • 2. XSL Fragment
            Level 7
            P.S. my XSL fragment is:

            <?xml version="1.0" encoding="iso-8859-1"?><!--
            DWXMLSource=" http://www.burnettcom.com/blog/?feed=rss2" -->
            <!DOCTYPE xsl:stylesheet [
            <!ENTITY nbsp "&#160;">
            <!ENTITY copy "&#169;">
            <!ENTITY reg "&#174;">
            <!ENTITY trade "&#8482;">
            <!ENTITY mdash "&#8212;">
            <!ENTITY ldquo "&#8220;">
            <!ENTITY rdquo "&#8221;">
            <!ENTITY pound "&#163;">
            <!ENTITY yen "&#165;">
            <!ENTITY euro "&#8364;">
            ]>
            <xsl:stylesheet version="1.0"
            xmlns:xsl=" http://www.w3.org/1999/XSL/Transform"
            xmlns:wfw=" http://wellformedweb.org/CommentAPI/"
            xmlns:content=" http://purl.org/rss/1.0/modules/content/"
            xmlns:dc=" http://purl.org/dc/elements/1.1/">
            <xsl:output method="html" encoding="iso-8859-1"/>

            <xsl:param name="ItemsPerPage" select="10" />

            <xsl:template match="/">

            <xsl:for-each select="rss/channel/item[position() &lt;= $ItemsPerPage]">
            <xsl:sort select="dc:date" order="descending" />
            <p>
            <a href="{link}"><xsl:value-of select="title"/>
            </a><br />
            <xsl:value-of select="pubDate"/>
            </p>
            </xsl:for-each>

            </xsl:template>
            • 3. Re: XSL Fragment
              BKBK Adobe Community Professional & MVP
              I think you have to modify the date format in the RSS (XML) file, before transforming it. The XSL file's job is simply to transform the XML data you pass to it.

              • 4. Re: XSL Fragment
                Level 7
                BKBK wrote:
                > I think you have to modify the date format in the RSS (XML) file, before transforming it. The XSL file's job is simply to transform the XML data you pass to it.

                Do you know how I'd need to do that?

                I also asked this question in the WordPress forum and got this response:

                "The time format in an RSS feed is fixed to a given standard, you cannot
                change it without invalidating your feed. Your blog options have no
                effect on the content of the feed's datetime format.

                "So since you can't change the feed, you'll have to do it in the CF or
                the XSL. Beyond that, I cannot help you, as I know neither of those. "

                http://tinyurl.com/m74me
                • 5. Re: XSLT and CF help
                  tconley
                  Something like this should get Month Day, Year

                  <xsl:variable name="varMonthAbbrev" select="substring(pubDate, 9, 4)"/>

                  <xsl:if test="$varMonthAbbrev = 'Jan'">
                  <xsl:text>January </xsl:text>
                  </xsl:if>
                  <xsl:if test="$varMonthAbbrev = 'Feb'">
                  <xsl:text>February </xsl:text>
                  </xsl:if>
                  <xsl:if test="$varMonthAbbrev = 'Mar'">
                  <xsl:text>March </xsl:text>
                  </xsl:if>
                  ...

                  <xsl:value-of select="substring(pubDate, 6, 2)"/>
                  <xsl:text>, </xsl:text>
                  <xsl:value-of select="substring(pubDate, 13, 4)"/>
                  • 6. Re: XSL Fragment
                    BKBK Adobe Community Professional & MVP
                    > "The time format in an RSS feed is fixed to a given standard, you cannot
                    > change it without invalidating your feed. Your blog options have no
                    > effect on the content of the feed's datetime format.

                    > "So since you can't change the feed, you'll have to do it in the CF or
                    > the XSL. Beyond that, I cannot help you, as I know neither of those. "


                    Hmm, I suppose it's gonna have to be XSL then. The following suggestion is more or less a modular version of Tconley's.

                    • 7. Re: XSL Fragment
                      Level 7
                      BKBK,

                      You are a genius!!! This is exactly what I wanted!!!! Thank you!!!

                      I had been fooling around with the xsl and cf files for hours and hours
                      with no success. This is perfect!

                      Thanks again!


                      BKBK wrote:
                      > > "The time format in an RSS feed is fixed to a given standard, you cannot
                      > > change it without invalidating your feed. Your blog options have no
                      > > effect on the content of the feed's datetime format.
                      >
                      > > "So since you can't change the feed, you'll have to do it in the CF or
                      > > the XSL. Beyond that, I cannot help you, as I know neither of those. "

                      >
                      > Hmm, I suppose it's gonna have to be XSL then. The following suggestion is
                      > more or less a modular version of Tconley's.
                      >
                      >
                      >
                      > <xsl:stylesheet version="1.0"
                      > xmlns:xsl=" http://www.w3.org/1999/XSL/Transform"
                      > xmlns:wfw=" http://wellformedweb.org/CommentAPI/"
                      > xmlns:content=" http://purl.org/rss/1.0/modules/content/"
                      > xmlns:dc=" http://purl.org/dc/elements/1.1/">
                      > <xsl:output method="html" encoding="iso-8859-1"/>
                      > <xsl:param name="ItemsPerPage" select="10" />
                      > <xsl:template match="/">
                      > <xsl:for-each select="rss/channel/item[position() &lt;= $ItemsPerPage]">
                      > <xsl:sort select="dc:date" order="descending" />
                      > <p>
                      > <a href="{link}"><xsl:value-of select="title"/></a><br />
                      > <xsl:variable name="reformatted_date">
                      > <xsl:call-template name="reformat-date">
                      > <xsl:with-param name="input_date" select="pubDate"/>
                      > </xsl:call-template>
                      > </xsl:variable>
                      > <xsl:value-of select="$reformatted_date"/>
                      > </p>
                      > </xsl:for-each>
                      > </xsl:template>
                      > <xsl:template name="reformat-date">
                      > <xsl:param name="input_date"/>
                      > <xsl:variable name="month" select="substring($input_date, 9, 3)"/>
                      > <xsl:choose>
                      > <!-- Full month name -->
                      > <xsl:when test="$month='Jan'">January </xsl:when>
                      > <xsl:when test="$month='Feb'">February </xsl:when>
                      > <xsl:when test="$month='Mar'">March </xsl:when>
                      > <xsl:when test="$month='Apr'">April </xsl:when>
                      > <xsl:when test="$month='May'">May </xsl:when>
                      > <xsl:when test="$month='Jun'">June </xsl:when>
                      > <xsl:when test="$month='Jul'">July </xsl:when>
                      > <xsl:when test="$month='Aug'">August </xsl:when>
                      > <xsl:when test="$month='Sep'">September </xsl:when>
                      > <xsl:when test="$month='Oct'">October </xsl:when>
                      > <xsl:when test="$month='Nov'">November </xsl:when>
                      > <xsl:when test="$month='Dec'">December </xsl:when>
                      > </xsl:choose>
                      > <xsl:value-of select="substring($input_date, 6, 2)"/>
                      > <xsl:text>, </xsl:text>
                      > <xsl:value-of select="substring($input_date, 13, 4)"/>
                      > </xsl:template>
                      > </xsl:stylesheet>
                      >