Page 1 of 1

How do I NOT display time if not present in xml

Posted: Wed Oct 08, 2014 6:21 pm
by winkimjr2
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>. I want this <ServiceTime></ServiceTime> displayed instead. I think I can add an If statement to the xslt code to check if the timeserved is blank and if it is do not enter 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))"/>
</ext:ProtectionOrderServiceTime>

Re: How do I NOT display time if not present in xml

Posted: Thu Oct 09, 2014 4:05 pm
by winkimjr2
winkimjr2 wrote:Resolved