xsl-list
[Top] [All Lists]

RE: html: datetime e bit type

2004-04-26 05:27:21
Hi,

i create a xml template to query a sql database. I like to 
view results in html format and i create a xsl file to do this.
I like to view datetime field in a better format that default 
in my html table.. How can I change the output format of 
datetime field? 

See the FAQ <http://www.dpawson.co.uk/xsl/sect2/dates.html> - you need to use 
the XPath String functions 
<http://www.w3.org/TR/xpath.html#section-String-Functions> to parse the date 
string and format it. There are extensions <http://exslt.org/date/index.html> 
but they are not supported by all XSLT processors

More: I like to view "TRUE" or "FALSE" instead of 1 or 0 of 
bit field. It's Possibile? 

if you have e.g.

  <foo>1</foo>

Then use

  <xsl:template match="value">
    <xsl:choose>
      <xsl:when test=". = 1">TRUE</xsl:when>
      <xsl:otherwise>FALSE</xsl:otherwise>
    </xsl:choose>
  <xsl:template>

or

  <xsl:value-of select="boolean(number(.))"/>

if lowercase text is acceptable.

Cheers,

Jarno - De/Vision: Endlose Traume


<Prev in Thread] Current Thread [Next in Thread>