How do I display the most recent HearingDate?

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

How do I display the most recent HearingDate?

Tue Jun 02, 2015 5:01 pm

What I want to do is...to determining Hearing Date.

I want to evaluate the Hearing records in the xml document. If more than one Hearing ID is found, use the most recent HearingDate that has passed. Skip records where SettingID/Cancelled = “True”

If multiple hearings are on a case the most recent hearing date should be selected to populate the outbound message.
How do I do this?

xml document

Code: Select all

<Integration xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:tsg="http://tsgweb.com" xmlns:IXML="http://tsgweb.com" xmlns:CMCodeQueryHelper="urn:CMCodeQueryHelper" PackageID="DL Notice to DVS" MessageID="67086844" xmlns="">
   <Case InternalID="1616832909" ID="11783147" xmlns:user="http://tylertechnologies.com">
      <Hearing ID="153546512" InternalHearingEventID="1716143353">
         <Setting ID="23490064" InternalSettingID="1623782066" Date="05/14/2014">-->
            <HearingDate>01/01/2014</HearingDate>
         </Setting>
      </Hearing>
      <Hearing ID="155794813" InternalHearingEventID="1717919318">
         <Setting ID="23727431" InternalSettingID="1623950282" Date="07/09/2014">
            <HearingDate>07/09/2014</HearingDate>
         </Setting>
      </Hearing>
      <Hearing ID="158501312" InternalHearingEventID="1720225032">
         <Setting ID="24032349" Cancelled="true" InternalSettingID="1624178189" Date="07/11/2014">
            <HearingDate>07/11/2014</HearingDate>

         </Setting>
      </Hearing>
      <Hearing ID="158551556" InternalHearingEventID="1720240342">
         <Setting ID="24040436" InternalSettingID="1624179819" Date="08/20/2014">
            <HearingDate>08/20/2014</HearingDate>

         </Setting>
      </Hearing>

   </Case>
</Integration>


My xsl line of code to get the HearingDate. I need to check for hearing and select the most recent HearingDate which do not have Hearing/Setting/@Cancelled="true"

Code: Select all

<xsl:value-of select="mscef:formatDate(string(Hearing/Setting[not(@Cancelled)]/HearingDate))"/>
winkimjr2
Posts: 53

Re: How do I display the most recent HearingDate?

Tue Jun 02, 2015 7:21 pm

I resolved this one

Code: Select all

<xsl:for-each select="Hearing/Setting[not(Cancelled)]">
                     <xsl:sort select="HearingDate" order="descending"/>
                     <xsl:if test="position() = 1">
                        <xsl:value-of select="mscef:formatDate(string(HearingDate))"/>
                     </xsl:if>
                  </xsl:for-each>

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 0 guests