Error in date:format-date EXSLT template?

"Cymbala, Greg" <[email protected]>
Newsgroups gmane.text.xml.xslt.extensions
Message-ID <0AE581CA3361D0488C5942C2188F708F018DCB1A@dentdsexc03.tds.corp.cendant.org>
I've been using the date:format-date XSLT template (date.format-date.template.xsl) for some time now, but just recently tried using it with some single-quoted literals in it.  I found that if there was only one single-quoted literal, it did fine, but if there were multiple literals, it failed, seeming to lump them all together as one long literal.
 
for example: 
 
EEEE dd' of 'MMMM' of 'yyyy
or
yyyy'年'M'月'd'日'
 
would return something like "Wednesday 22 of MMMM of 2006" or "2006年M月d日".
 
After about a day of trying to figure it out, I think I traced it back to changing a "2" to a "3" in this parameter:
 
<xsl:with-param name="pattern" select="substring($pattern, string-length($literal-value) + 3)" />
 
near the bottom of this xsl:when in the <xsl:template name="date:_format-date"> template:
 
<xsl:when test='$char = "&apos;"'>
 <xsl:choose>
  <xsl:when test='substring($pattern, 2, 1) = "&apos;"'>
   <xsl:text>&apos;</xsl:text>
   <xsl:call-template name="date:_format-date">
    <xsl:with-param name="year" select="$year" />
    <xsl:with-param name="month" select="$month" />
    <xsl:with-param name="day" select="$day" />
    <xsl:with-param name="hour" select="$hour" />
    <xsl:with-param name="minute" select="$minute" />
    <xsl:with-param name="second" select="$second" />
    <xsl:with-param name="timezone" select="$timezone" />
    <xsl:with-param name="pattern" select="substring($pattern, 3)" />
   </xsl:call-template>
  </xsl:when>
  <xsl:otherwise>
   <xsl:variable name="literal-value" select='substring-before(substring($pattern, 2), "&apos;")' />
   <xsl:value-of select="$literal-value" />
   <!--<br />[char=&quot;<xsl:value-of select="$char"/>&quot;]<br />
      <br />[$pattern=&quot;<xsl:value-of select="$pattern"/>&quot;]<br />-->
   <xsl:call-template name="date:_format-date">
    <xsl:with-param name="year" select="$year" />
    <xsl:with-param name="month" select="$month" />
    <xsl:with-param name="day" select="$day" />
    <xsl:with-param name="hour" select="$hour" />
    <xsl:with-param name="minute" select="$minute" />
    <xsl:with-param name="second" select="$second" />
    <xsl:with-param name="timezone" select="$timezone" />
    <xsl:with-param name="pattern" select="substring($pattern, string-length($literal-value) + 3)" />
   </xsl:call-template>
  </xsl:otherwise>
 </xsl:choose>
</xsl:when>
 
I've not tested this extensively, pretty much just with the examples I gave above, plus a few variations on them.  I hope that you can add this change in to help others from getting as frustrated as I was with this little glitch.
 
Greg Cymbala

The information in this electronic mail message is sender's 
business Confidential and may be legally privileged.  It is 
intended solely for the addressee(s).  Access to this Internet 
electronic mail message by anyone else is unauthorized.  If 
you are not the intended recipient, any disclosure, copying, 
distribution or any action taken or omitted to be taken in 
reliance on it is prohibited and may be unlawful. The sender 
believes that this E-mail and any attachments were free of 
any virus, worm, Trojan horse, and/or malicious code when 
sent. This message and its attachments could have been 
infected during  transmission. By reading the message and 
opening any attachments, the recipient accepts full 
responsibility for taking protective and remedial action about 
viruses and other defects. Cendant is not liable for any loss 
or damage arising in any way from this message or its 
attachments.

_______________________________________________
exslt mailing list
[email protected]
http://www.exslt.org/list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.