Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 8th, 2014, 11:50 AM
Friend of Wrox
 
Join Date: Apr 2013
Posts: 101
Thanks: 14
Thanked 0 Times in 0 Posts
Default Do not add 00:00:00-05:00 when time element is blank

I have xml code with 2 elements one for timeServed and the other for dateServed. When timeServed element is empty, my xslt is showing <ServiceTime>00:00:00-05:00</ServiceTime>. Instead I want this <ServiceTime></ServiceTime> displayed.
I think I can add an If statement to the xslt code below to check if the timeserved is blank and if it is do not display anything. i.e do not display the 00:00:00-05:00.
How do I do this?


Desired output

<ServiceDate>2014-10-08</ServiceDate>
<ServiceTime></ServiceTime>


Current output which is wrong
<ServiceDate>2014-10-08</ServiceDate>
<ServiceTime>00:00:00-05:00</ServiceTime>

My XML code
dateServed="10/08/2014"
timeServed=""

My XSLT code. I have concatenated time dateserved and timeserved together using a function mscef:formatTime
<ServiceTime>
<xsl:value-of select="mscef:formatTime(concat(@dateServed,' ',@timeServed))"/>
</ServiceTime>





Similar Threads
Thread Thread Starter Forum Replies Last Post
I Get # 12:00:00 AM # but no Date brucechess BOOK: Beginning VB.NET Databases 2 October 22nd, 2009 09:13 PM
accuracy of Now+timevalue("00:00:01") gwron Excel VBA 1 September 3rd, 2009 07:49 AM
add a '.00' crmpicco Classic ASP Basics 1 February 15th, 2005 06:53 AM
Format rounding figure : 1235.00 => 1200.00 Jane SQL Language 1 June 27th, 2003 02:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.