Jump to content

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
Link to comment
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"/>
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...