How do I NOT display time if not present in xml

Here should go questions about transforming XML with XSLT and FOP.
winkimjr2
Posts: 62
Joined: Thu Jun 26, 2014 9:00 pm

How do I NOT display time if not present in xml

Post 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>
winkimjr2
Posts: 62
Joined: Thu Jun 26, 2014 9:00 pm

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

Post by winkimjr2 »

winkimjr2 wrote:Resolved
Post Reply