How do I NOT display time if not present in xml

Here should go questions about transforming XML with XSLT and FOP.
winkimjr2
Posts: 53

How do I NOT display time if not present in xml

Wed Oct 08, 2014 6:21 pm

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: 53

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

Thu Oct 09, 2014 4:05 pm

winkimjr2 wrote:Resolved

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 3 guests