How do I display CommercialVehicleFlag?

Here should go questions about transforming XML with XSLT and FOP.
winkimjr2
Posts: 58
Joined: Thu Jun 26, 2014 9:00 pm

How do I display CommercialVehicleFlag?

Post by winkimjr2 » Tue Jun 02, 2015 8:26 pm

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

Code: Select all

/Integration/Case/Charge/Vehicle/VehicleLicensePlateNumber 
and failing this xpath

Code: Select all

/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

CODE --> 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="DL Notice to DVS" MessageID="67084884" xmlns="">
<Case Op="E" InternalID="1617090736" ID="12125870" xmlns:user="http://tylertechnologies.com">
<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

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="DL Notice to DVS" MessageID="67086833" xmlns="">
<Citation ID="5380737" xmlns:user="http://tylertechnologies.com">
<CitationNumber>33</CitationNumber>
<TicketDate>12/25/2014</TicketDate>
<Vehicle>
<CommercialVehicleFlag>false</CommercialVehicleFlag>
<HazardousVehicleFlag>false</HazardousVehicleFlag>
</Vehicle>
</Citation>
</Integration>
my xsl code

Code: Select all

<xsl:value-of select="../CommercialVehicleFlag"/>