tips & tricks


Calendario
aprile 2024
lmmgvsd
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

xsl:template

Nell' Xsl viene utilizzato come una function nello jscript, se scrivo un template per formattare le date:

  <xsl:template name="DecodeDate">
        <xsl:param name="DateUTC"/>
        <xsl:choose>
            <xsl:when test="$DateUTC != '' ">
                <xsl:value-of select="substring($DateUTC , 9 ,2)"/>/<xsl:value-of select="substring($DateUTC , 6 ,2) "/>/<xsl:value-of select="substring($DateUTC , 1 ,4) "/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$DateUTC" />
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

<xsl:template name="FormatCurrency">
  <xsl:param name="Impo"/>
  <xsl:value-of select="translate(format-number($Impo, '##.00'),'.',',')"/>
 </xsl:template>

Lo posso poi richiamare all'interno del file come una funzione senza dover ogni volta ripetere il codice:

 <xsl:call-template name="DecodeDate">
     
<xsl:with-param name="DateUTC" select="Entities/HotelAccommodation/DateEnd/."/>

</xsl:call-template>

        
<xsl:call-template name="FormatCurrency">
                 <xsl:with-param name="Impo" select="sum(/Entities/HotelAccommodationRate/BaseAmount/.)"/>  
</xsl:call-template>
 

Categoria: XML
giovedì, 01 mag 2008 Ore. 17.34
Archivio Posts
Anno 2020

Anno 2018

Anno 2015

Anno 2013

Anno 2011

Anno 2010

Anno 2009

Anno 2008
Statistiche
  • Views Home Page: 13.355
  • Views Posts: 56.096
  • Views Gallerie: 2.837
  • n° Posts: 117
  • n° Commenti: 1
Copyright © 2002-2007 - Blogs 2.0
dotNetHell.it | Home Page Blogs
ASP.NET 2.0 Windows 2003