Preformatting RFC 822 using XSLT 1.0

Discussion in 'XML' started by Jure Sah, Mar 7, 2009.

  1. Jure Sah

    Jure Sah Guest

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Hello,

    How can I remove the optional weekday plus comma from a RFC 822 date
    using just XSLT 1.0 functions?

    The problem is a RFC 822 date is either:

    Fri, 06 Mar 2009 02:04:00 +0000

    ....or...

    06 Mar 2009 02:04:00 +0000

    I want either date to end up as:

    06 Mar 2009 02:04:00 +0000

    How can I do this using just XSLT 1.0 functions? Using XSLT tags is not
    an option in this case, I need it in functions.

    Thanks a bunch for any help in advance.

    LP,
    Jure
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.6 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

    iD8DBQFJsvDNB6mNZXe93qgRAiNQAKC25/TzAyXsvs9ulBjSYxcG9fIq+QCZAVR7
    IC1xmYMjNybLlgTcXuPfPzA=
    =xxuR
    -----END PGP SIGNATURE-----
     
    Jure Sah, Mar 7, 2009
    #1
    1. Advertisements

  2. Jure Sah

    Jure Sah Guest

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Spoke too soon.

    The motto of XSLT should be: Never give up.

    substring(date,string-length(date)-25)

    LP,
    Jure
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.6 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

    iD8DBQFJsvKhB6mNZXe93qgRAkqrAJ4wKc7rGegk7hX7R4Awvi1I1FbgywCffhAa
    meC4y1F7lHEMDtZf5VavdGw=
    =PfcV
    -----END PGP SIGNATURE-----
     
    Jure Sah, Mar 7, 2009
    #2
    1. Advertisements

  3. Jure Sah

    Peter Flynn Guest

    Or perhaps, a little more obviously, substring-after(date,', ') when it
    contains a comma-space, and just the value-of when it doesn't.

    ///Peter
     
    Peter Flynn, Mar 9, 2009
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.