AnsweredAssumed Answered

Format date in web form rendition

Question asked by tolofisto on Mar 4, 2010
Hi,
i have a web form defined by this schema:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:pr="http://www.alfresco.org/alfresco/pr"
           targetNamespace="http://www.alfresco.org/alfresco/pr"
           elementFormDefault="qualified">

  <!– defines the form for creating a press release –>
  <xs:element name="news_item">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="titulo" type="xs:normalizedString"/>
      <xs:element name="contenido" type="xs:string"/>
       <xs:element name="fecha_alta" type="xs:date"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>


and this is the xsl to make an html rendition

<xsl:stylesheet version="1.0"
      xmlns:xhtml="http://www.w3.org/1999/xhtml"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:pr="http://www.alfresco.org/alfresco/pr"
      xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      exclude-result-prefixes="xhtml">
  <xsl:output method="html"  encoding="UTF-8" indent="yes"
              doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
              doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'/>

  <xsl:preserve-space elements="*"/>
  <xsl:template match="/">
   <div id="news_div">
      <xsl:variable  name="date_new" select="/pr:news_item/pr:fecha_alta"/>
      <h2 class="news_h2"><xsl:value-of select="fn:day-from-date(xs:date(@date_new))"/></h2>
      <h3 class="news_h3"><xsl:value-of select="/pr:news_item/pr:titulo"/></h3>
       <p><xsl:value-of select="normalize-space(/pr:news_item/pr:contenido)" disable-output-escaping="yes"/></p>
      <a href="/noticias/">(Ver todas)</a>
   </div>
  </xsl:template>
</xsl:stylesheet>

But i can´t use correctly the function fn:day-from-date to get the day from de date. I´ve tried using any combination, but all fails when i create a new content using the webfom.
Someone can help me?
Thanks in advance, and regards.

Outcomes