Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XSLT coding
Message
From
15/11/2007 10:13:21
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Miscellaneous
Thread ID:
01260126
Message ID:
01269156
Views:
14
Hi Fabio,

Thanks for the info. Sorry, I just now open my UT.

Regards,
Sam

>Hi, Sam
>
>The current XML and XSLT versions don't handle dates very well. XSLT 2 is supposed to understand dates as first class citizens. For now, if we want to handle date semantics into our XML and XSLT documents, we need to create dates following the ISO 8601 specification. This basically means treating dates as strings on the format "YYYYMMDD".
>
>The following XSL transformation fragment shows how we can acomplish that:
>
>
><xsl:if test="@discount_applies = 'Y'">
>
>  <xsl:variable name="baseDate" select="20070928" />
>  <xsl:variable name="itemDate" select="concat(substring(@date,7,4), substring(@date,4,2), substring(@date,1,2))" />
>
>  <xsl:choose>
>    <xsl:when test ="$itemDate >= $baseDate"></xsl:when>
>    <xsl:otherwise>
>      <xsl:value-of select="discountvalue" />
>      <xsl:text> </xsl:text>
>      <xsl:value-of select="@disc_value - @mk_value" />
>    </xsl:otherwise>
>  </xsl:choose>
>
></xsl:if>
>
>
>Just out of curiosity, when LINQ to XML is out, we will be able to handle dates more easily in .NET programs.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform