现有和新的xml的XSLT比较

时间:2017-02-28 13:20:25

标签: xslt comparison

我正在尝试比较两个xml节点但是现在深度相等的XSLT函数返回我的假,即使两个xml节点直接相同。

我有两个变量,一个包含新的计算值($ key-data-val):

<translation-key key="00016403"><textinfo SPRAS="E" MAKTX="Heater-defrost"/></translation-key>

另一个是现有的($ existing-asset):

<asset id="104606" version="21" currversion="0" content_version="1" id_extern="bsh:cmd.temp-keyset.00016403" name="csmatke y-00016403" type="temp." application="default" state="0" deletion="0" modified_by="361" domain="root." domain2="root." modified_date="2017-02-28T13:10:27Z" non_owner_access="2" iscancellation="0" has_master_file="0" has_update_geometry="0" storage_state="0" created_by="361" creation_date="2017-02-28T11:10:55Z" rowid="AAAFBCAAFAAAUkuAAd" usn="0" tcn="60" ccn="61">
   <asset_feature sid="1665764" asset_id="104606" asset_currversion="0" feature="bsh:cmd.importer-type" isversioned="0" timestamp="2017-02-28T13:10:27Z" party="361" value_string="csmatkeys" rowid="AAAFFNAAFAAARmzABU" />
   <asset_feature sid="1665763" asset_id="104606" asset_version="21" feature="bsh:cmd.processing-status" isversioned="1" timestamp="2017-02-28T13:10:27Z" party="361" value_key="todo" rowid="AAAFFNAAFAAARmzAA/" />
   <asset_feature sid="1665765" asset_id="104606" asset_currversion="0" feature="bsh:cmd.record" isversioned="0" timestamp="2017-02-28T13:10:27Z" party="361" rowid="AAAFFNAAFAAARmNAAg">
      <xmldata>
         <translation-key key="00016403">
            <textinfo SPRAS="E" MAKTX="Heater-defrost" />
         </translation-key>
      </xmldata>
   </asset_feature>
   <asset_feature sid="1665760" asset_id="104606" asset_version="21" feature="censhare:owner" isversioned="1" timestamp="2017-02-28T11:10:55Z" party="361" value_long="2" rowid="AAAFFNAAFAAARmzAA9" />
   <asset_feature sid="1665761" asset_id="104606" asset_version="21" feature="censhare:owner" isversioned="1" timestamp="2017-02-28T11:10:55Z" party="361" value_long="361" rowid="AAAFFNAAFAAARmzAA+" />
   <asset_feature sid="1665762" asset_id="104606" asset_version="21" feature="censhare:uuid" isversioned="1" timestamp="2017-02-28T11:10:55Z" party="361" value_string="931a4670-fda6-11e6-b375-06002d8a858f" rowid="AAAFFNAAFAAARmzAA8" />
</asset>

所以我只是想比较翻译键的内容是否不同或相同,如果它们不同,我会将新内容覆盖到该资产中。

那么我想要比较翻译密钥的两个节点:

<xsl:message>Comparison check : <xsl:value-of select="deep-equal($existing-asset//translation-key,$keydata-val)"/></xsl:message>

返回false,我想检查元素内容是否被更改,可能会添加文本信息或删除的文本信息,或者textinfo属性中的内容可能会被更改,任何这些情况都应该返回false

但是现在深度平等直接让我失去了......

任何人都可以帮助我如何实现这个目标来比较像deeppequal函数这样的两个节点吗?

0 个答案:

没有答案