I have modified this question by adding a more detailed xsl code showing two templates that I am using. CommercialVehicleFlag can be under Charge which is under Case or under Citation which is under Case.
I want to check for CommercialVehicleFlag in both places that is under /Integration/Case/Charge/Vehicle/VehicleLicensePlateNumber and /Integration/Citation/Vehicle/CommercialVehicleFlag in xml document.
Do I use for each statement if a if statement to check before selecting the value of?
My xsl is only working for VehicleLicensePlateNumber in this xpath
and failing this xpath
In my xsl I need to check for both paths. How do I do this?
xml document with CommercialVehicleFlag under Charge
xml document with CommercialVehicleFlag under Citation
My xsl code which is only displaying CommercialVehicleFlag under Charge and not under Citation
I want to check for CommercialVehicleFlag in both places that is under /Integration/Case/Charge/Vehicle/VehicleLicensePlateNumber and /Integration/Citation/Vehicle/CommercialVehicleFlag in xml document.
Do I use for each statement if a if statement to check before selecting the value of?
My xsl is only working for VehicleLicensePlateNumber in this xpath
XML:
/Integration/Case/Charge/Vehicle/VehicleLicensePlateNumber
and failing this xpath
XML:
/Integration/Citation/Vehicle/CommercialVehicleFlag
In my xsl I need to check for both paths. How do I do this?
xml document with CommercialVehicleFlag under Charge
XML:
<Integration xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:tsg="[URL unfurl="true"]http://tsgweb.com"[/URL] xmlns:IXML="[URL unfurl="true"]http://tsgweb.com"[/URL] xmlns:CMCodeQueryHelper="urn:CMCodeQueryHelper" PackageID="DL Notice to DVS" MessageID="67084884" xmlns="">
<Case Op="E" InternalID="1617090736" ID="12125870" xmlns:user="[URL unfurl="true"]http://tylertechnologies.com">[/URL]
<CaseNumber>55</CaseNumber>
<Charge ID="10906336" PartyID="16770378" InternalChargeID="1616713996" InternalPartyID="1614673416" xmlns:reslib="urn:reslib">
<ChargeOffenseDate>05/28/2015</ChargeOffenseDate>
<Vehicle>
<VehicleLicensePlateState>MM</VehicleLicensePlateState>
<VehicleLicensePlateNumber>ASD123</VehicleLicensePlateNumber>
<VehicleMake Word="JEEP">Jeep</VehicleMake>
<CommercialVehicleFlag>false</CommercialVehicleFlag>
<HazardousVehicleFlag>false</HazardousVehicleFlag>
</Vehicle>
</Charge>
</Case>
</Integration>
xml document with CommercialVehicleFlag under Citation
XML:
<Integration xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:tsg="[URL unfurl="true"]http://tsgweb.com"[/URL] xmlns:IXML="[URL unfurl="true"]http://tsgweb.com"[/URL] xmlns:CMCodeQueryHelper="urn:CMCodeQueryHelper" PackageID="DL Notice to DVS" MessageID="67086833" xmlns="">
<Citation ID="5380737" xmlns:user="[URL unfurl="true"]http://tylertechnologies.com">[/URL]
<CitationNumber>33</CitationNumber>
<TicketDate>12/25/2014</TicketDate>
<Vehicle>
<CommercialVehicleFlag>false</CommercialVehicleFlag>
<HazardousVehicleFlag>false</HazardousVehicleFlag>
</Vehicle>
</Citation>
</Integration>
My xsl code which is only displaying CommercialVehicleFlag under Charge and not under Citation
Code:
My xsl code which is only displaying CommercialVehicleFlag under Charge and not under Citation
<!--Template for ext:Charge-->
<xsl:template name="Charge">
<ext:Charge>
<xsl:choose>
<xsl:when test="(count(ChargeHistory[@Stage='Disposition Event']))>0">
<xsl:for-each select="ChargeHistory[@Stage='Disposition Event']">
<xsl:sort select="@DispositionEventSequence" data-type="number" order="descending"/>
<xsl:if test="position()=1">
<xsl:call-template name="ChargeDetails"/>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="ChargeHistory[@Stage='Case Filing']">
<xsl:sort select="@FilingSequence" data-type="number" order="descending"/>
<xsl:if test="position()=1">
<xsl:call-template name="ChargeDetails"/>
</xsl:if>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</ext:Charge>
</xsl:template>
<!--Charge Details Template-->
<xsl:template name="ChargeDetails">
<j:ChargeSequenceID>
<xsl:value-of select="ChargeNumber"/>
</j:ChargeSequenceID>
<j:ChargeStatute>
<j:StatuteDescriptionText>
<xsl:value-of select="Statute/StatuteCode"/>
</j:StatuteDescriptionText>
<j:StatuteText>
<xsl:value-of select="Statute/StatuteCode/@Word"/>
</j:StatuteText>
</j:ChargeStatute>
<j:ChargeSeverityDescriptionText>
<xsl:value-of select="Statute/Degree"/>
</j:ChargeSeverityDescriptionText>
<ext:Citation>
<nc:ActivityDate>
<xsl:for-each select="/Integration/Citation/CitationCharge[ChargeID=current()/../@ID]">
<nc:Date>
<xsl:value-of select="mscef:formatDate(string(../TicketDate))"/>
</nc:Date>
</xsl:for-each>
</nc:ActivityDate>
<nc:Identification>
<nc:IdentificationID>
<xsl:value-of select="/Integration/Citation/CitationNumber"/>
</nc:IdentificationID>
<nc:IdentificationJurisdiction>
<nc:JurisdictionText>
<xsl:value-of select="/Integration/Citation/Agency/@Word"/>
</nc:JurisdictionText>
</nc:IdentificationJurisdiction>
</nc:Identification>
</ext:Citation>
<ext:Vehicle>
<nc:VehicleCMVIndicator>
<xsl:for-each select="/Integration/Citation/Vehicle[CommercialVehicleFlag]">
<xsl:for-each select="//Case/Charge/Vehicle[CommercialVehicleFlag]">
<xsl:value-of select="../Vehicle/CommercialVehicleFlag"/>
</xsl:for-each>
</xsl:for-each>
</nc:VehicleCMVIndicator>
</ext:Vehicle>
</xsl:template>