Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSL Gurus: Using Javascript in XSL

Status
Not open for further replies.

dwarfthrower

Programmer
Apr 22, 2003
1,625
AU
Howdy,

I'm writing a portal application for a client and need to be able to present the contents of the user's mailbox as a nicely formatted HTML page.

I've got the XML source coming out of the Domino server and my XSL is processing it nicely - sort by date and all that.

My problem is that the date is being rendered in the Domino format
Code:
20030519T020629,46+10
which, if seen by Joe User, usually elicits a shrill scream. Writing the Javascript to convert this to a more user-friendly dd/mm/yyyy is easy. My problem is including the Javascript in the xsl file so that instead of calling:
Code:
<xsl:value-of select=&quot;entrydata[@columnnumber='2']/datetime&quot; />
which returns the ugly system date representation,

I can call something along the lines of:
Code:
formatdate(<xsl:value-of select=&quot;entrydata[@columnnumber='2']/datetime&quot; />)
and return a nicely formatted date.

Any assistance on including scripts in XSL would be heartily appreciated.

Cheers
 
Nevermind, I found the native XSL substring() function.

Code:
<xsl:value-of select=&quot;substring(entrydata[@columnnumber='2']/datetime,7,2)&quot; />/<xsl:value-of select=&quot;substring(entrydata[@columnnumber='2']/datetime,5,2)&quot; />/<xsl:value-of select=&quot;substring(entrydata[@columnnumber='2']/datetime,1,4)&quot; />

Works perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top