如何将车辆制造商的 NCIC 代码值转换为 DCCIS 代码值? [英] How do I convert NCIC code value to DCCIS code value for vehicle make?

查看:25
本文介绍了如何将车辆制造商的 NCIC 代码值转换为 DCCIS 代码值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

业务分析师告诉业务规则已更改.现在他们要我首先检查(计数)以查看是否有多个 NcicCode(在 VehicleMakeMapping 查找文档中)匹配 MncisCode(在输入文档中).如果 VehicleMakeMapping 查找文档中有多个 NcicCode,则只使用第一个 NcicCode 作为输出.还要检查是否有完全匹配(1 到 1)并在有完全匹配的地方使用 NcicCode.否则,如果没有与 MncisCode 匹配的 NcicCode,则不显示任何内容(什么都不做).

The business analyst told business rule for this has changed. Now they want me to first check (count) to see if there are more than one NcicCode (in the VehicleMakeMapping lookup document) matching MncisCode(in the input document). If there are more than one NcicCode in the VehicleMakeMapping lookup document, then just use the first NcicCode as the output. Also check if there is exact match (1 to 1) and use the NcicCode where there is exact match. Otherwise, if there is no matching NcicCode to the MncisCode then do not display anything (do nothing).

我现在使用的新 XML 文件如下所示:

The new XML file I am now using looks like this:

    <VehicleMakeMapping>
    <Mapping>
        <NcicCode>AUHE</NcicCode>
        <MncisCode>AUST</MncisCode>
        <Description>Austin-Healy</Description>
    </Mapping>
<Mapping>
    <NcicCode>JEEP</NcicCode>
    <MncisCode>JEEP</MncisCode>
    <Description>Jeep (for model years 1989 throughresent)</Description>
</Mapping>
<Mapping>
    <NcicCode>JEP</NcicCode>
    <MncisCode>JEEP</MncisCode>
    <Description>Jeep (for model years prior to 1970)</Description>
</Mapping>  
    <Mapping>
        <NcicCode>AUPR</NcicCode>
        <MncisCode>AUST</MncisCode>
        <Description>Austin Products, Inc.Subsidiary Austin Industries, Inc.</Description>
    </Mapping>
    <Mapping>
        <NcicCode>CHRS</NcicCode>
        <MncisCode>CHRY</MncisCode>
        <Description>Chrysler Boat Co.</Description>
    </Mapping>
    <Mapping>
        <NcicCode>CHRY</NcicCode>
        <MncisCode>CHRY</MncisCode>
        <Description>Chrysler</Description>
    </Mapping>
</VehicleMakeMapping>

这些显示例如 NCIC 代码 MRCU 必须转换为 DCCIS 代码 MERC 等.

These shows for example NCIC code MRCU has to be converted into DCCIS code MERC etc.

Xml 文档

 <Integration xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:tsg="http://tsgweb.com" xmlns:IXML="http://tsgweb.com" xmlns:CMCodeQueryHelper="urn:CMCodeQueryHelper" PackageID="IXML Case Notification Test" MessageID="67078058" xmlns="">
<Case InternalID="1616807927" ID="11747370" xmlns:user="http://tylertechnologies.com">
    <Charge ID="10547226" PartyID="16580814" CurrSentenceID="155092098" InternalChargeID="1616447618" InternalPartyID="1614482843" xmlns:reslib="urn:reslib">
        <ChargeOffenseDate>03/26/2014</ChargeOffenseDate>
        <Vehicle>
            <VehicleLicensePlateState>DC</VehicleLicensePlateState>
            <VehicleLicensePlateNumber>050KTU</VehicleLicensePlateNumber>
            <VehicleType Word="PASSVEH">Jeep (for model years prior to 1970)</VehicleType>
            <VehicleMake Word="JEEP">Austin-Healy</VehicleMake>
            <CommercialVehicleFlag>false</CommercialVehicleFlag>
            <HazardousVehicleFlag>false</HazardousVehicleFlag>
            <VehicleInactive>false</VehicleInactive>
        </Vehicle>
    </Charge>
</Case>

xslt

<xsl:template name="ChargeDetails">
    <ext:Vehicle>
        <nc:ItemStyleText>
            <xsl:value-of select="Vehicle/VehicleType"/>
        </nc:ItemStyleText>
        <nc:VehicleCMVIndicator>
            <xsl:value-of select="/Integration/Case/Charge/Vehicle/CommercialVehicleFlag"/>
        </nc:VehicleCMVIndicator>
        <j:VehicleMakeCode>
            <xsl:variable name="vVehicleMake">
        <xsl:value-of select="Vehicle/VehicleMake/@Word"/>                     </xsl:variable>
        <xsl:variable name="vVehicleMakeCode" select="document(concat($gEnvPath,'\Schemas\CourtXML\ConfigFiles\VehicleMakeMapping.xml'))/VehicleMakeMapping/Mapping[MncisCode=$vVehicleMake]/MncisCode"/>           <xsl:value-of select="$vVehicleMakeCode"/>              
        </j:VehicleMakeCode>
    </ext:Vehicle>

推荐答案

如果 VehicleMakeMapping 查找中有多个 NcicCode文档,然后只使用第一个 NcicCode 作为输出.

If there are more than one NcicCode in the VehicleMakeMapping lookup document, then just use the first NcicCode as the output.

为了简化问题,让我们有:

To simplify the question, let us have:

XML

<root>
    <Vehicle>
        <VehicleMake Word="ABC">not important</VehicleMake>
    </Vehicle>
    <Vehicle>
        <VehicleMake Word="XYZ">not important</VehicleMake>
    </Vehicle>
</root>

VehicleMakeMapping.xml

<VehicleMakeMapping>
    <Mapping>
        <NcicCode>ABCA</NcicCode>
        <MncisCode>ABC</MncisCode>
        <Description>abc</Description>
    </Mapping>
    <Mapping>
        <NcicCode>ABCB</NcicCode>
        <MncisCode>ABC</MncisCode>
        <Description>abc abc</Description>
    </Mapping>
    <Mapping>
        <NcicCode>ABCC</NcicCode>
        <MncisCode>ABC</MncisCode>
        <Description>abc abc abc</Description>
    </Mapping>  
</VehicleMakeMapping>

XSLT 2.0

<xsl:stylesheet version="2.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:param name="map-doc" select="'path/to/VehicleMakeMapping.xml'"/>

<xsl:key name="mapping" match="Mapping" use="MncisCode" />

<xsl:template match="/root">
    <xsl:copy>
        <xsl:apply-templates select="Vehicle"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="Vehicle">
    <Vehicle>
        <VehicleMakeCode>
            <xsl:value-of select="key('mapping', VehicleMake/@Word, document($map-doc))[1]/NcicCode"/>                     
        </VehicleMakeCode>
    </Vehicle>
</xsl:template>

</xsl:stylesheet>

结果

<?xml version="1.0" encoding="UTF-8"?>
<root>
   <Vehicle>
      <VehicleMakeCode>ABCA</VehicleMakeCode>
   </Vehicle>
   <Vehicle>
      <VehicleMakeCode/>
   </Vehicle>
</root>

这篇关于如何将车辆制造商的 NCIC 代码值转换为 DCCIS 代码值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆