How do I get TicketDate from xml document?

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

How do I get TicketDate from xml document?

Fri May 22, 2015 11:39 pm

I would like to get TicketDate where ChargeID is the same as CitationCharge/ChargeID. There could be several ChargeIDs with several CitationIDs. So I will need to check where ChargeID matches CitationCharge/ChargeID so that I get the right TicketDate.

Desired output should look like this

Code: Select all

<nc:ActivityDate>2014-03-26</nc:ActivityDate>


XML

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="IXML Case Notification Test" MessageID="67084253" xmlns="">
   <Case Op="E" InternalID="1617090499" ID="12125626" xmlns:user="http://tylertechnologies.com">
      <Charge ID="10906090" PartyID="16765959" InternalChargeID="1616713754" InternalPartyID="1614667066" xmlns:reslib="urn:reslib">
         <ChargeOffenseDate>04/13/2015</ChargeOffenseDate>
            <ChargeHistory ChargeHistoryID="42933438" Stage="Case Filing" FilingSequence="1" CurrentCharge="true" InternalOffenseHistoryID="1637029057">
            <ChargeNumber>1</ChargeNumber>
         </ChargeHistory>
         <ChargeHistory ChargeHistoryID="42933437" Stage="Citation Issued" CitationEventSequence="1" InternalOffenseHistoryID="1637029056">
            <ChargeNumber>1</ChargeNumber>
         </ChargeHistory>
         <Deleted>false</Deleted>
      </Charge>
      <Charge ID="10906091" PartyID="16765959" InternalChargeID="1616713755" InternalPartyID="1614667066" xmlns:reslib="urn:reslib">
         <ChargeOffenseDate>04/13/2015</ChargeOffenseDate>
         <ChargeHistory ChargeHistoryID="42933440" Stage="Case Filing" FilingSequence="1" CurrentCharge="true" InternalOffenseHistoryID="1637029059">
            <ChargeNumber>2</ChargeNumber>
         </ChargeHistory>
         <ChargeHistory ChargeHistoryID="42933439" Stage="Citation Issued" CitationEventSequence="1" InternalOffenseHistoryID="1637029058">
            <ChargeNumber>2</ChargeNumber>
         </ChargeHistory>
      </Charge>
   </Case>
   <Citation ID="5385330" xmlns:user="http://tylertechnologies.com">
      <CitationNumber>12345</CitationNumber>
      <OffenseDate>04/13/2015</OffenseDate>
      <TicketDate>04/13/2015</TicketDate>
      <CitationCharge>
         <ChargeID>10906090</ChargeID>
         <ChargeHistoryID>42933437</ChargeHistoryID>
         <ChargeNumber>1</ChargeNumber>
         <SequenceNumber>1</SequenceNumber>
      </CitationCharge>
   </Citation>
   <Citation ID="5385331" xmlns:user="http://tylertechnologies.com">
      <CitationNumber>54321</CitationNumber>
      <OffenseDate>04/13/2015</OffenseDate>
      <TicketDate>04/13/2015</TicketDate>
      <CitationCharge>
         <ChargeID>10906091</ChargeID>
         <ChargeHistoryID>42933439</ChargeHistoryID>
         <ChargeNumber>2</ChargeNumber>
         <SequenceNumber>1</SequenceNumber>
      </CitationCharge>
   </Citation>
</Integration>


XSL

Code: Select all

<xsl:template name="ChargeDetails">
<ext:Citation>
    <nc:AvtivityDate>
        <xsl:if test="Charge[@ID=current()/../CitationCharge/ChargeID]">
        <nc:Date>
            <xsl:value-of select="mscef:formatDate(string(/Integration/Citation/TicketDate))"/>
        </nc:Date>
    </xsl:if>
    </nc:AvtivityDate>
</ext:Citation>
</xsl:template>

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 1 guest