【发布时间】:2017-05-12 06:48:33
【问题描述】:
我是 Xslt 的新手,我想处理具有两个相同节点但只有一个不同属性的 XML。基于不同的属性输出应该在同一行上有两个不同的列。 如果数据集 ID 以 8 位数字开头,则应进入“数据集 ID 1”列;如果以 10 位数字开头,则应进入“数据集 ID 2”列 这是 XML-
<?xml version="1.0" encoding="ISO-8859-1"?>
<DisplayDefinitionTable>
<columns>
<column_entry order_num="1">Name</column_entry>
<column_entry order_num="2">Id</column_entry>
<column_entry order_num="3">DatasetID</column_entry>
</columns>
<rows>
<row>
<object_tag tag="45106" uid="yfVhkbLv6Vq5bD"/>
<object_tag tag="45922" uid="BebdkpIm6Vq5bD"/>
<row_element column="1" component_tag="45925" property_name="name">DEM</row_element>
<row_element column="2" component_tag="45925" property_name="Id">8888431618</row_element>
<row_element column="3" component_tag="50853" property_name="DatasetID">31661449AA</row_element>
</row>
<row>
<object_tag tag="45106" uid="yfVhkbLv6Vq5bD"/>
<object_tag tag="45922" uid="BebdkpIm6Vq5bD"/>
<row_element column="1" component_tag="45925" property_name="name">DEM</row_element>
<row_element column="2" component_tag="45925" property_name="Id">8888431618</row_element>
<row_element column="3" component_tag="50854" property_name="DatasetID">8888431618A</row_element>
</row>
<row>
<object_tag tag="45175" uid="HReh0zDS6Vq5bD"/>
<object_tag tag="45922" uid="BebdkpIm6Vq5bD"/>
<row_element column="1" component_tag="51997" property_name="name">CEM</row_element>
<row_element column="2" component_tag="51997" property_name="Id">8888516207</row_element>
<row_element column="3" component_tag="52010" property_name="DatasetID">8888516207/C</row_element>
</row>
<row>
<object_tag tag="45175" uid="HReh0zDS6Vq5bD"/>
<object_tag tag="45922" uid="BebdkpIm6Vq5bD"/>
<row_element column="1" component_tag="51997" property_name="name">CEM</row_element>
<row_element column="2" component_tag="51997" property_name="Id">8888516207</row_element>
<row_element column="3" component_tag="52011" property_name="DatasetID">31661809AB</row_element>
</row>
<row>
<object_tag tag="44593" uid="07Uh0rzi6Vq5bD"/>
<object_tag tag="45922" uid="BebdkpIm6Vq5bD"/>
<row_element column="1" component_tag="52019" property_name="name">TT</row_element>
<row_element column="2" component_tag="52019" property_name="Id">8888574081</row_element>
<row_element column="3" component_tag="52992" property_name="DatasetID">8888574081/C</row_element>
</row>
<row>
<object_tag tag="44593" uid="07Uh0rzi6Vq5bD"/>
<object_tag tag="45922" uid="BebdkpIm6Vq5bD"/>
<row_element column="1" component_tag="52019" property_name="name">TT</row_element>
<row_element column="2" component_tag="52019" property_name="Id">8888574081</row_element>
<row_element column="3" component_tag="52993" property_name="DatasetID">31691071/AC</row_element>
</row>
</DisplayDefinitionTable>
我期待像这样的输出
Name ID DatasetId1 DatasetId2
DEM 8888431618 31661449AA 8888431618A
CEM 8888516207 31661809AB 8888516207/C
【问题讨论】:
-
请发布您的尝试以便我们修复它,而不必从头开始为您编写代码。
-
我尝试了以下代码,但它给出了两行:
-
请不要尝试在 cmets 中发布代码 - 而是编辑您的问题。