Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 每个(组?)的XSLT,包含两个排序元素,分别命名为代码和值_Xml_Xslt_Xfdf - Fatal编程技术网

Xml 每个(组?)的XSLT,包含两个排序元素,分别命名为代码和值

Xml 每个(组?)的XSLT,包含两个排序元素,分别命名为代码和值,xml,xslt,xfdf,Xml,Xslt,Xfdf,我需要将文件xml传输到xfdf。我有两种元素类型,代码和值。代码是定义字段的名称,值是字段的值。XML源代码如下所示: <urn:identifications> <urn:identificationCode>dateOfBirth</urn:identificationCode> <urn:identificationValue>25021965</urn:identificationValue> <urn:i

我需要将文件xml传输到xfdf。我有两种元素类型,代码和值。代码是定义字段的名称,值是字段的值。XML源代码如下所示:

 <urn:identifications>
  <urn:identificationCode>dateOfBirth</urn:identificationCode>
  <urn:identificationValue>25021965</urn:identificationValue>
  <urn:identificationCode>ičdph</urn:identificationCode>     <!-- IC DPH -->
  <urn:identificationValue>1234567890</urn:identificationValue>
  <urn:identificationCode>ičo_sk</urn:identificationCode>      <!-- ICO (SK) -->
  <urn:identificationValue>0987654333</urn:identificationValue>
  <urn:identificationCode>ic</urn:identificationCode>      <!-- ICO (CZ) -->
  <urn:identificationValue>0987654321</urn:identificationValue>
  ...
</urn:identifications>

出生日期
25021965
ičdph
1234567890
伊契奥斯克
0987654333
集成电路
0987654321
...
我需要类似于XSLT到XFDF的东西

<identifications>
 <field name="dateOfBirth">
   <value>25021965</value>
 </field>
 <field name="ičdph">
   <value>1234567890</value>
 </field>
 <field name="ičo_sk">
   <value>0987654333</value>
 </field>
 <field name="ic">
   <value>0987654321</value>
 </field>
  ...
</identifications>

25021965
1234567890
0987654333
0987654321
...

我需要用什么?怎么用?每一组?还是som集?非常感谢。

如果它们总是按您的示例中所示的顺序成对出现,那么您可以简单地执行以下操作:

<xsl:template match="urn:identifications">
    <identifications>
        <xsl:for-each select="urn:identificationCode">
            <field name="{.}">
                <value>
                    <xsl:value-of select="following-sibling::urn:identificationValue[1]"/>
                </value>
            </field>
        </xsl:for-each>
    </identifications>
</xsl:template>

正在工作。谢谢!:)