[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: splitting the date field in xml
Hi Obviously with... <satire> <xsl:script implements="really-obvious-regex-things-XSLT-pretends-it-doesn't-need" language="perl"> </satire> More seriously: I've cheated a bit and made two assumptions: 1. that the length of the day of the month field never changes 2. that the length of the of the time field never changes You can probably fix it if only one of those changes with a string-length() - eg if the string is less than 28 characters you know you're dealing with a shortened date or time and can wrap it in an xsl:when If both change - eg, if you don't pad date and time with leading zeroes, then i'm baffled. I also cheated and pinched the padding spaces from the string itself. <?xml version="1.0"?> <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:template match="Context"> <xsl:value-of select="substring(Date, 5, 4)" /><xsl:value-of select="substring(Date, 9, 3)" /> <xsl:value-of select="substring(Date, 25, 4)" /> </xsl:template> </xsl:stylesheet> -- jim smith 020 7837 0377 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|