This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Can I take only parts from node value?
- From: "jp" <jp at tribalstorm dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Tue, 19 Feb 2002 18:27:56 +0100
- Subject: RE: [xsl] Can I take only parts from node value?
- Reply-to: xsl-list at lists dot mulberrytech dot com
Yes, I got it working!
Thanks for help :)
XML:
<calendar date="200202180800" />
XSL:
<xsl:variable name = "year" select = "substring(@date,0,5)" />
<xsl:variable name = "month" select = "substring(@date,5,2)" />
<xsl:variable name = "day" select = "substring(@date,7,2)" />
<xsl:variable name = "hour" select = "substring(@date,9,2)" />
<xsl:variable name = "minute" select = "substring(@date,11)" />
<xsl:value-of select="$year"/>
<xsl:value-of select="$month"/>
<xsl:value-of select="$day"/>
<xsl:value-of select="$hour"/>
<xsl:value-of select="$minute"/>
Regs,
-JP
-----Original Message-----
From: owner-xsl-list@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com] On Behalf Of Michael Kay
Sent: 19. helmikuuta 2002 18:06
To: xsl-list@lists.mulberrytech.com
Subject: RE: [xsl] Can I take only parts from node value?
> If I have XML-tag like this:
>
> <today date="200202190800" />
>
> and I want output:
>
> Time is 08:00
> Date is 19.02
> Year is 2002
>
> How can I do this with XSL/T?
With the substring() function.
Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list