BizTalk Utilities CV ,   Jobs ,   Code library
 
Home Page


Add/Edit your code items
Search the code library
Browse for the code library


XSLT
XSLT Template for HTML INPUT Tag
XSLT Template for HTML IMG Tag
XSLT Search and Replace Template
Word wrap and text replace templates for XSLT
nxslt 1.3
Visual XPath
xframe - xsddoc
-xsl-fo-->-pdf--making-an-e-book/documentation.aspx>BIBLE PDF from (xml & xsl)-> xsl-fo -> pdf ; Making an E-book/documentation
Sum(round(.))
DISTINCT list of attributes using XPATH only
How to add a XSL information to the XML file with the XmlTextWriter?
How to update an XML file with XmlDocument?
How to select specific nodes in XmlDocument()?
How to use GetElementsByTagName in XmlDocument?
How to Import a Node with XmlDocument and ImportNode?
How to Clone a Node with XmlDocument and CloneNode?
How to use XPath correctly?
How to add Processing Information with XmlDocument?
How to sort an XML using XPathExpression and AddSort?
How to perform a case-sensitive search with XPath and the translate ...


 
 

<< XQuery.NET and XML >>


By Mike DiRenzo
First Posted 10/14/2003
Times viewed 852

XSLT Date filtering, sorting, comparing, and evaluating


Summary A sure-fire technique for working with XSLT Date operations

Ever try using <xsl:date-format select=MyDateNode>?
Well, it doesn't work because it doesn't exist. So my guess is, NO! If you haven't had to work with XSLT Date operations, you will. As of this writing, there is not a whole lot of help out there. So.... Here is a technique that might help you and it involves the following functions:
ISO-8601 XSL Date Format: 2003-10-14T00:00:00.0000
  • number() - to convert the node expression to a number
  • translate() - to strip out the dashes
  • substring() - to get the first 10 digits

Nested one inside the other may eat up some processor cycles so it may be interpretted as ugly or inefficient - but it works.
In the form:number(translate(substring()))
Here it is in action:
xmlDoc.SelectNodes(/DateExpire[number(translate(substring(.,1,10),'-','')) > 20021212])


Rate this article on a scale of 1 to 10 (1 votes, average 10)

Your vote :  

<< XQuery.NET and XML >>





Leave a comment for this article
Your name
Your email (optional)
Your comment
Optional: Upload an attachment
Enter the code shown:

 
 

    Email TopXML