Page 1 of 1

How do I display timeServed in xsl transformation based on x

Posted: Fri Jun 27, 2014 5:13 pm
by winkimjr2
How do I use when to display nothing if timeServed="8:25 AM" is not provided in xml document? Right now it is displaying time because there is time in xml. What do I do so when there is no timeServed nothing is displayed?
My xml

Code: Select all

<xsl:template match="NotificationEvent[@notificationType='ProtectionOrderService']">
<ext:ProtectionOrderService>
<ext:ProtectionOrderServiceTime>
<xsl:value-of select="mscef:formatTime(concat(@dateServed,' ',@timeServed))"/>
</ext:ProtectionOrderServiceTime>
</ext:ProtectionOrderService>
</xsl:template>
my xsl

Code: Select all

<NotificationEvent notificationType="ProtectionOrderService" timeServed="8:25 AM" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions"></NotificationEvent>

Re: How do I display timeServed in xsl transformation based

Posted: Fri Jun 27, 2014 6:05 pm
by adrian
See here example 2:
http://www.w3schools.com/xsl/el_when.asp
So for your case:

Code: Select all

<xsl:when test="@timeServed">
...
Regards,
Adrian

Re: How do I display timeServed in xsl transformation based

Posted: Fri Jun 27, 2014 6:16 pm
by winkimjr2
adrian wrote:See here example 2:
http://www.w3schools.com/xsl/el_when.asp
So for your case:

Code: Select all

<xsl:when test="@timeServed">
...
Regards,
Adrian
It is now working but I used if instead. Thanks for your help