如何显示NcicCode匹配的VehicleMake(MncisCode)?

时间:2015-06-09 20:24:47

标签: xml xslt

我有一个带有ui-sref="dashboard.hive-reports.{{hiveReports.reportSelected}}()"> 元素的xml文档。我想将其与ui-sref="dashboard.hive-reports.{{hiveReports.reportSelected}}({})"> 代码相匹配。 我的输出仅显示与<VehicleMake Word="MERC">Mercury</VehicleMake>匹配的第一个<NcicCode>MERC</NcicCode>。引用文档中的<NcicCode>与我的xml文档中的<MncisCode>代码相同。

当前输出

<MncisCode>

所需的输出应为NcicCode = MncisCode

<VehicleMakeCode>

我的示例xml文档

<ext:Vehicle>
    <j:VehicleMakeCode>MERB</j:VehicleMakeCode>
</ext:Vehicle>

我的样本引用xml文档

<ext:Vehicle>
    <j:VehicleMakeCode>MERC</j:VehicleMakeCode>
</ext:Vehicle>

我的示例xslt代码

<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="67092480" xmlns="">
    <Case Op="E" InternalID="1617090885" ID="12126951" xmlns:user="http://tylertechnologies.com">
        <Charge ID="10906495" PartyID="1466236" InternalChargeID="1616714163" InternalPartyID="704451330" xmlns:reslib="urn:reslib">
            <ChargeOffenseDate>06/05/2015</ChargeOffenseDate>
            <Vehicle>
                <VehicleMake Word="MERC">Mercury</VehicleMake>
            </Vehicle>
        </Charge>
    </Case>
    <Citation ID="5385632" xmlns:user="http://tylertechnologies.com">
        <CitationNumber>TLA060515C</CitationNumber>
        <TicketDate>06/05/2015</TicketDate>
        <Vehicle>
            <VehicleMake Word="MERC">Mercury</VehicleMake>
        </Vehicle>
    </Citation>
</Integration>

1 个答案:

答案 0 :(得分:0)

您还必须在谓词中添加Description节点比较。我猜的是:

<xsl:variable name="vVehicleMakeCode" select="document(concat($gEnvPath,'\ConfigFiles\VehicleMakeMapping.xml'))/VehicleMakeMapping/Mapping[MncisCode=$vVehicleMake and Description=$vVehicleMakeContent]/NcicCode"/>

您必须将$vVehicleMakeContent映射到目标节点的内容。

修改

试试这个:

<xsl:variable name="vVehicleMakeCode" select="document(concat($gEnvPath,'\ConfigFiles\VehicleMakeMapping.xml'))/VehicleMakeMapping/Mapping[MncisCode=$vVehicleMake and MncisCode=NcicCode]/NcicCode"/>