0
我有一个简单的问题,但我无法找出我做错了什么。XSLT问题显示每个使用的值
我有一个XML这种结构:
<?xml version='1.0' encoding='UTF-8'?>
<GateDocument version="3">
<TextWithNodes>
<Node id="0"/>Ecuador
<Node id="1"/> Argentina
<Node id="2"/>Colombia
</TextWithNodes>
<!-- The default annotation set -->
</GateDocument>
我需要将其转换为一个简单的结构。所以我用XSLT转换文件与此结构:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/GateDocument">
<GateDocument>
<TextWithNodes>
<xsl:for-each select="TextWithNodes/Node">
<node>
<id><xsl:value-of select="@id"/></id>
<value><xsl:value-of select="Node"/></value>
</node>
</xsl:for-each>
</TextWithNodes>
</GateDocument>
</xsl:template>
</xsl:stylesheet>
但是XML输出的节点标记值丢失:
<GateDocument>
<TextWithNodes>
<node>
<id>0</id>
<value></value>
</node>
<node>
<id>1</id>
<value></value>
</node>
<node>
<id>2</id>
<value></value>
</node>
</TextWithNodes>
</GateDocument>
我觉得有什么不对与XSLT,但我不能整理出来。
预期的结果是:
<GateDocument>
<TextWithNodes>
<node>
<id>0</id>
<value>Ecuador</value>
</node>
<node>
<id>1</id>
<value>Argentina</value>
</node>
<node>
<id>2</id>
<value>Colombia</value>
</node>
</TextWithNodes>
</GateDocument>
嗨!谢谢回答!我试过了,似乎没有工作。 – Jay
谢谢!!!工作中!!!干杯!!! – Jay