|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: parsing string or numbers after x characters
Hi,
> I'm quite new to the xsl mailing list so I have no idea if
> this problem
> occurred already and I was unable to find the solution on the web.
>
> My problem is that I receive for example a date in a
> concatenated format:
>
> Ex: 20041207
>
> And I have to retrieve it in a readable format through my xslt-fo
> transformation.
>
> Ex. 12 July 2004
>
> I tried using the substring attribute for that, but I don't have any
> reference character to look at so it doesn't work. Is there a
> function
> which parses strings or numbers after a certain amount of characters
> directly?
Substring function <http://www.w3.org/TR/xpath#function-substring>.
concat(substring(., 5, 2), ' ',
substring('JanFebMarAprMayJunJulAugSepOctNovDec', substring(., 7, 2) * 3 - 2,
3), ' ', substring(., 1, 4))
will give you "12 Jul 2004", but for complete month names
concat(substring(., 5, 2), ' ', document('')/*/x:months/month[position() =
substring(current(), 7, 2)], ' ', substring(., 1, 4))
with a top level element
<x:months>
<month>January</month>
<month>February</month>
<month>March</month>
...
</x:months>
Cheers,
Jarno - Delerium: After All (Svenson & Gielen Remix)
|
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
|

Cart








