我有一個帶有<VehicleMake Word="MERC">Mercury</VehicleMake>
元素的xml文檔。我想將它與<NcicCode>MERC</NcicCode>
代碼相匹配。 我的輸出僅顯示匹配<MncisCode>
的第一個<NcicCode>
。引用文檔中的<MncisCode>
與我的xml文檔中的<VehicleMakeCode>
代碼相同。如何顯示匹配VehicleMake(MncisCode)的NcicCode?
電流輸出
<ext:Vehicle> <j:VehicleMakeCode>MERB</j:VehicleMakeCode> </ext:Vehicle>
希望的輸出應爲NcicCode = MncisCode
<ext:Vehicle> <j:VehicleMakeCode>MERC</j:VehicleMakeCode> </ext:Vehicle>
我的示例XML文檔
<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>
我的樣品指XML文檔
<?xml version="1.0" encoding="UTF-8"?>
<VehicleMakeMapping>
<Mapping>
<NcicCode>MERB</NcicCode>
<MncisCode>MERC</MncisCode>
<Description>Mercury Boat Co.</Description>
</Mapping>
<Mapping>
<NcicCode>MERC</NcicCode>
<MncisCode>MERC</MncisCode>
<Description>Mercury</Description>
</Mapping>
<Mapping>
<NcicCode>MERH</NcicCode>
<MncisCode>MERC</MncisCode>
<Description>Mercury Coach Corp.</Description>
</Mapping>
<Mapping>
<NcicCode>MERR</NcicCode>
<MncisCode>MERC</MncisCode>
<Description>Mercury Trailer Industries</Description>
</Mapping>
<Mapping>
<NcicCode>METE</NcicCode>
<MncisCode>MERC</MncisCode>
<Description>Meteor (Canadian Mercury)</Description>
</Mapping>
<Mapping>
<NcicCode>MRCU</NcicCode>
<MncisCode>MERC</MncisCode>
<Description>Mercury (See Mercury Marine)</Description>
</Mapping>
</VehicleMakeMapping>
我的示例XSLT代碼
<j:VehicleMakeCode>
<xsl:variable name="vVehicleMakeCode" select="document(concat($gEnvPath,'\ConfigFiles\VehicleMakeMapping.xml'))/VehicleMakeMapping/Mapping[MncisCode=$vVehicleMake]/NcicCode"/>
<xsl:value-of select="$vVehicleMakeCode"/>
</j:VehicleMakeCode>
在示例文檔,所有的'Mapping'元素具有相同的'MncisCode',所以怎麼會知道匹配哪一個?謝謝! –
這個問題與以前的問題有何不同:http://stackoverflow.com/questions/30127613/how-do-i-convert-ncic-code-value-to-dccis-code-value-for-vehicle-使? –
業務分析師表示(也使用'VehicleMake'描述)他們想要的。VehicleMake返回值將基於MNCIS代碼。 NCIC代碼沒有與MNCIS中使用的車輛代碼相匹配的代碼。當XML中的結果包括VehicleMake時,請將該值從MNCIS值轉換爲VehicleMake Mapping文檔中的匹配NCIC值。如果爲MNCIS代碼找到多個NCIC代碼,請查找完全匹配並填充,否則請跳過此元素。 如果沒有爲MNCIS代碼找到NCIC代碼,請跳過填充該元素。 – Angela