Here is my sample xml document with 2 Charges. Each Charge has a child element (Vehicle) which has the CommercialVehicleFlag.
Sometimes a xml document may have under Integration, a Citation which will have
CommercialVehicleFlag (xpath) /Integration/Citation/CommercialVehicleFlag).
or for this particular xml document
/Integration/Charge/Vehicle/CommercialVehicleFlag.
For that reason I need to check CommercialVehicleFlag from tow different places (xpaths) so as to display them based on where they are located. Either under Citation or under Charge.
Desired output
Code:
<Charge ID="10905889">
<Vehicle>
<CommercialVehicleFlag>false</CommercialVehicleFlag>
</Vehicle>
</Charge>
<Charge ID="10905890">
<Vehicle>
<CommercialVehicleFlag>true</CommercialVehicleFlag>
</Vehicle>
</Charge>
My sample xml document
Code:
<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="67084403" xmlns="">
<Case Op="E" InternalID="1617090273" ID="12124494" xmlns:user="http://tylertechnologies.com">
<Charge ID="10905889">
<Vehicle>
<CommercialVehicleFlag>false</CommercialVehicleFlag>
</Vehicle>
</Charge>
<Charge ID="10905890">
<Vehicle>
<CommercialVehicleFlag>true</CommercialVehicleFlag>
</Vehicle>
</Charge>
</Case>
</Integration>
My xsl line of code which is returning false for both
Code:
<xsl:value-of select="(/Integration/Citation/Vehicle[CommercialVehicleFlag]|/Integration/Case/Charge/Vehicle[CommercialVehicleFlag])[1]/CommercialVehicleFlag"/>