xsl-list
[Top] [All Lists]

RE: Date formatting using XSLT extensions functions

2003-04-28 07:04:10
DaveP,

Thanks for the advice. It is looking more and more likely that I'll have
to become stricter with the initial date format being input. However, as
I mentioned, the date formats I described are all parsed and handled OK
through the VBScript Date functions, when used in ASP page or VB, so I
was hoping to access those functions through the use of an XSLT
extension function, as described below and in the original thread, since
I can, at least, guarantee the platform that it will be running on.
However, I have failed in my attempt to use the VBScript Date functions
as extensions. Any ideas?

Thanks again for the valuable input.


Kaine


(Code from original thread)
VBScript version:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:extra="urn:extra-functions">

        <msxml:script xmlns:msxml="urn:schemas-microsoft-com:xslt"
language="VBScript" implements-prefix="extra">
                Function DateFormat(InputDate)
                        If IsDate(InputDate) Then
                                DateFormat = Day(InputDate) & " " &
Month(InputDate)
                        End If
                End Function
        </msxml:script>

        <xsl:output method="xml" version="1.0" encoding="UTF-8"
indent="yes"/>



        <xsl:template name="format-date">
                <xsl:param name="date-to-format" />


                <xsl:value-of select="extra:DateFormat($date-to-format)"
/>
        </xsl:template>

</xsl:stylesheet>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list