Jump to content
Sign in to follow this  

How do I find ChargeID for the Plea using InternalOffenseHis

Recommended Posts

What I am trying to do is get the ChargeID=10485838. To get this ChargeID, I need to look in the ChargeHistory element for the Stage="Plea Event" and find the PleaEventSequence value with the highest event number (for example PleaEventSequence="2") and then find the Plea in the PleaEvent node whose ChargeHistoryID matches the Charge node's ChargeHistoryID . In my case this would be ChargeHistoryID="41274044"
How do I do this?


I have attached my xml code because it is too long.

See attached file

Here is my xslt template code

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <xsl:variable name="vPleaEventID"> <xsl:call-template name="GetChargePleaEventID"> <xsl:with-param name="pChargeID"></xsl:with-param> </xsl:call-template> </xsl:variable> <result> <xsl:value-of select="$vPleaEventID"/> </result> </xsl:template> <!-- --> <xsl:template name="GetChargePleaEventID"> <xsl:param name="pChargeID"/> <xsl:value-of select="$pChargeID"/> </xsl:template></xsl:stylesheet>


Edited by winkimjr2

Share this post

Link to post
Share on other sites
I have resolved this by adding 2 variables.
XSLT code
<xsl:variable name="vInternalOffenseHistoryID">	<xsl:value-of select="//Charge[@ID=$pChargeID]/ChargeHistory[@Stage='Plea Event'][last()]/@InternalOffenseHistoryID"/></xsl:variable><xsl:variable name="vPleaEventID">	<xsl:value-of select="//PleaEvent[count(Plea[@InternalOffenseHistoryID=$vInternalOffenseHistoryID])>0]/@ID"/></xsl:variable>	<xsl:value-of select="$vPleaEventID"/>

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...