Jump to content

How do I concatenate HearingDate and StartTime?


Recommended Posts

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:

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

Here is my xslt code that is not displaying anything

<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>
Link to comment
Share on other sites

In the output--value-of element's select attribute-- [condition logic goes here]... If and choose don't output anything, they just test for a truthy value.You can just instead use if or/and choose.In the choose/when node put a value-of element, and the path that is to the first court time element in the select attribute.And a otherwise for the second court time.In the when element's test attribute, just put the path to the element, the same you will do for the value of element's select attribute.If this help you, check my check button please.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...