Jump to content

How do I display CommercialVehicleFlag?


winkimjr2

Recommended Posts

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
<Charge ID="10905889">        <Vehicle>            <CommercialVehicleFlag>false</CommercialVehicleFlag>        </Vehicle>    </Charge>    <Charge ID="10905890">        <Vehicle>            <CommercialVehicleFlag>true</CommercialVehicleFlag>        </Vehicle>    </Charge>

My sample xml document. Sometimes a document may have Citation with Vehicle and CommercialVehicleIndicator. The xml document will never have both Citation and Charge at the same time.

<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
Integration/Case/Charge/Vehicle/CommercialVehicleFlag
and
Integration/Citation/Vehicle/CommercialVehicleFlag 

 

My xsl line of code

<xsl:value-of select="(/Integration/Citation/Vehicle[CommercialVehicleFlag]|/Integration/Case/Charge/Vehicle[CommercialVehicleFlag])[1]/CommercialVehicleFlag"/>
Edited by winkimjr2
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...