Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I output un-deleted judgment? 1

Status
Not open for further replies.

momo2000

Programmer
Jan 2, 2015
63
0
0
US
I have added new xml code because the previous code was incomplete.
I would like to return (output) only non-deleted judgment information, the original (base judgment information) when all of the amendments to it have been deleted and only a single instance of each judgment.
How do I do this?
Here is my xml 1.0 document

XML:
<?xml version="1.0" encoding="UTF-8"?>
<Pipeline xmlns="">
	<SourceXML>
		<Integration>
			<Case>
				<JudgmentEvent InternalID="1734529845" ID="175057896" Date="05/05/2016">
					<JudgmentEventType InternalID="13024" Word="JUDGGR">Judgment</JudgmentEventType>
					<IssueDate>05/05/2016</IssueDate>
					<AgingClockActionKey Word="SP">Stops case aging clock</AgingClockActionKey>
					<TimestampCreate>05/05/2016 09:40:03:713</TimestampCreate>
					<TimestampChange>05/05/2016 10:39:11</TimestampChange>
					<Deleted>true</Deleted>
					<RecordingNeeded>false</RecordingNeeded>
					<AmendReason InternalID="11091" Word="CTORDER">Court Order</AmendReason>
					<Judgment ID="3532520" InternalID="1612847489"/>
					<JudgmentEvent InternalID="1734529843" ID="175057895" Date="05/05/2016">
						<JudgmentEventType InternalID="13024" Word="JUDGGR">Judgment</JudgmentEventType>
						<IssueDate>05/05/2016</IssueDate>
						<AgingClockActionKey Word="SP">Stops case aging clock</AgingClockActionKey>
						<TimestampCreate>05/05/2016 09:38:56:520</TimestampCreate>
						<TimestampChange>05/05/2016 10:43:07</TimestampChange>
						<Deleted>false</Deleted>
						<RecordingNeeded>false</RecordingNeeded>
						<Judgment ID="3532519" InternalID="1612847488"/>
					</JudgmentEvent>
				</JudgmentEvent>
				<JudgmentEvent InternalID="1734529863" ID="175057907" Date="05/05/2016">
					<JudgmentEventType InternalID="13024" Word="JUDGGR">Judgment</JudgmentEventType>
					<IssueDate>05/05/2016</IssueDate>
					<AgingClockActionKey Word="SP">Stops case aging clock</AgingClockActionKey>
					<TimestampCreate>05/05/2016 10:43:07:857</TimestampCreate>
					<TimestampChange>05/06/2016 09:09:58</TimestampChange>
					<Deleted>true</Deleted>
					<RecordingNeeded>false</RecordingNeeded>
					<AmendReason InternalID="11091" Word="CTORDER">Court Order</AmendReason>
					<Judgment ID="3532521" InternalID="1612847490"/>
					<JudgmentEvent InternalID="1734529843" ID="175057895" Date="05/05/2016">
						<JudgmentEventType InternalID="13024" Word="JUDGGR">Judgment</JudgmentEventType>
						<IssueDate>05/05/2016</IssueDate>
						<AgingClockActionKey Word="SP">Stops case aging clock</AgingClockActionKey>
						<TimestampCreate>05/05/2016 09:38:56:520</TimestampCreate>
						<TimestampChange>05/05/2016 10:43:07</TimestampChange>
						<Deleted>false</Deleted>
						<RecordingNeeded>false</RecordingNeeded>
						<Judgment ID="3532519" InternalID="1612847488"/>
					</JudgmentEvent>
				</JudgmentEvent>
			</Case>
		</Integration>
	</SourceXML>
	<CourtXML/>
</Pipeline>

Correct output should look like this
XML:
<CourtDecisions>
    <FamilyJudgment judgmentKey="3532520">
        <JudgmentEventTypeText>Judgment</JudgmentEventTypeText>
        <JudgmentEventDate>2016-05-05</JudgmentEventDate>
        <AmendedJudgment>
            <AmendedReasonText>Court Order</AmendedReasonText>
            <AmendedDate>2016-05-05</AmendedDate>
            <JudgmentReference judgmentKey="3532519"/>
        </AmendedJudgment>
    </FamilyJudgment> 
</CourtDecisions>
 
I'm curious, but I don't understand the logic of your data, because you say non-deleted judgment, but both judgements
Code:
<Judgment ID="3532520" InternalID="1612847489"/>
and
Code:
<Judgment ID="3532521" InternalID="1612847490"/>
have inside
Code:
<Deleted>false</Deleted>
Then what is the reason that your desired output is only the first i.e.
Code:
<FamilyJudgment judgmentKey="3532520">
Other thing is that you have in your XML the mark JudgmentEvent embedded
Code:
<JudgmentEvent InternalID="1734529845" ID="175057896" Date="05/05/2016">
   ...
   <JudgmentEvent InternalID="1734529843" ID="175057895" Date="05/05/2016">
   ...
   </JudgmentEvent>
</JudgmentEvent>
It would may difficult to use SAX parser.





 
I have resolved this issue by adding a condition
Code:
<JudgmentEvent>
.

Here is my solution in xslt

Code:
<xsl:for-each select="descendant::JudgmentEvent[(Deleted='false') and (count(parent::JudgmentEvent[Deleted='false'])=0)]/Judgment">
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top