Convert string date to xslt RSS date

csaladores's Avatar

csaladores

23 Jun, 2015 07:52 PM

Hi,

Can you please help me converting string date to XSLT RSS date?

I have the string date in this format mm-dd-yyyy. IE. 06/04/2014

-->

RSS date format?

Thanks,
Christian

  1. 1 Posted by Ryan Griffith on 23 Jun, 2015 08:12 PM

    Ryan Griffith's Avatar

    Hi Christian,

    This can be accomplished by using our format date XSLT Format. Simply create this new Format within your instance and include it into your existing Format.

    You can find usage instructions within the comments at the top of the Format. In your case, try using the format-calendar-string template since you are working with what appears to be a date string.

    Please let me know if you have any questions.

    Thanks!

  2. 2 Posted by csaladores on 23 Jun, 2015 08:23 PM

    csaladores's Avatar

    I tried but no luck.

    Attached is my xsl.

  3. 3 Posted by Ryan Griffith on 24 Jun, 2015 12:41 PM

    Ryan Griffith's Avatar

    Hi Christian,

    It looks like you're on the right track. When you have a moment, try adjusting the following line:

    <xsl:with-param name="date" select="system-data-structure/date"/>
    

    to:

    <xsl:with-param name="date" select="string(system-data-structure/date)"/>
    

    Often times, the Element is passed into the template and not the actual text value of the Element.

    Please let me know if you have any questions.

    Thanks!

  4. 4 Posted by csaladores on 24 Jun, 2015 04:11 PM

    csaladores's Avatar

    Hi Ryan,

    I made the change but it stops on the first <pubDate> parse.

  5. 5 Posted by Ryan Griffith on 24 Jun, 2015 04:39 PM

    Ryan Griffith's Avatar

    Weird. When you have a moment, please attach sample XML that is being applied to this Format so I can take a closer look in my local instance.

    Thanks!

  6. 6 Posted by csaladores on 24 Jun, 2015 04:47 PM

    csaladores's Avatar

    That would be helpful. Will do.

  7. 7 Posted by csaladores on 24 Jun, 2015 04:50 PM

    csaladores's Avatar

    Here you go Ryan.

  8. 8 Posted by csaladores on 24 Jun, 2015 04:52 PM

    csaladores's Avatar

    Here is the RSS xsl

  9. 9 Posted by Ryan Griffith on 24 Jun, 2015 06:32 PM

    Ryan Griffith's Avatar

    Hi Christian,

    A couple of issues I am seeing with this Format:

    • Your Index Block is massive.
    • It appear you are using the one from our XSLT Workbook project. This format assumes you are including the Block via a block chooser on your page that is to generate the RSS feed. Easily adaptable; however, by tweaking this line:
      <xsl:template match="/system-data-structure|/system-index-block">
      
      to:
      <xsl:template match="/system-index-block">
      <!-- OR this if you want to keep existing functionality -->
      <xsl:template match="/system-data-structure|/system-index-block">
      
    • It appears the hh Xalan function is affecting the date formatter, causing the behavior you are seeing. What I did to get this working is remove that Xalan stuff all-together from your Format in favor of using the date formatter.

    Please let me know if you have any questions.

    Thanks!

  10. 10 Posted by csaladores on 24 Jun, 2015 06:34 PM

    csaladores's Avatar

    Great. I’ll give this a shot.

  11. 11 Posted by csaladores on 24 Jun, 2015 06:52 PM

    csaladores's Avatar

    Yup, I removed the xalan stuff and it worked. Thanks Ryan.

    Christian

  12. csaladores closed this discussion on 24 Jun, 2015 06:52 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac