How do I NOT display time if not present in xml
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 62
- Joined: Thu Jun 26, 2014 9:00 pm
How do I NOT display time if not present in xml
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>
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>
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service