How do I concatenate HearingDate and StartTime?
Posted: Tue Aug 12, 2014 7:51 pm
How do I get this result:
<ext:HearingDateTime>07/21/2014 8:30 AM</ext:HearingDateTime>
I have xml that have two StartTime and a HearingDate. The two StartTime are the same but one is near the top and the other one is a child of CourtSessionBlock.
The first StartTime is not always there which means sometimes the only available StartTime is the child of CourtSessionBlock.
For this reason, I need to first check if there is StartTime near the top of xml document. If it is there, I will use that StartTime concatenated with HearingDate. Otherwise if it's not there or when the only StartTime is the child of CourtSessionBlock, I will use that one. I have tried using <xsl:if> and <xsl:choose> but I am not getting anything displayed for the <ext:HearingDateTime/>. Please help.
Here is my xml code:
Here is my xslt code that is not displaying anything
<ext:HearingDateTime>07/21/2014 8:30 AM</ext:HearingDateTime>
I have xml that have two StartTime and a HearingDate. The two StartTime are the same but one is near the top and the other one is a child of CourtSessionBlock.
The first StartTime is not always there which means sometimes the only available StartTime is the child of CourtSessionBlock.
For this reason, I need to first check if there is StartTime near the top of xml document. If it is there, I will use that StartTime concatenated with HearingDate. Otherwise if it's not there or when the only StartTime is the child of CourtSessionBlock, I will use that one. I have tried using <xsl:if> and <xsl:choose> but I am not getting anything displayed for the <ext:HearingDateTime/>. Please help.
Here is my xml code:
Code: Select all
<Setting ID="21613643" InternalSettingID="1622304543" Date="07/21/2014">
<HearingDate>07/21/2014</HearingDate>
<StartTime>8:30 AM</StartTime>
<EndTime>9:30 AM</EndTime>
<CourtSessionBlock InternalCourtSessionBlockID="1614615037">
<StartTime>8:30 AM</StartTime>
<EndTime>9:30 AM</EndTime>
</CourtSessionBlock>
<TimestampCreate>07/15/2014 09:27:49:607</TimestampCreate>
</Setting>
Code: Select all
<ext:HearingDateTime>
<xsl:choose>
<xsl:when test="/Integration/Case/Setting/StartTime[1]">
<xsl:value-of select="StartTime"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="/Integration/Case/Hearing/Setting/CourtSessionBlock/StartTime"/>
</xsl:otherwise>
</xsl:choose>
</ext:HearingDateTime>