我有喜欢的xml:如何返回节点的文本,而不子节点文本
<item id="1">
<items>
<item id="2">Text2</item>
<item id="3">Text3</item>
</items>Text1
</item>
如何返回<item id="1">
(“文本1”)的文本? <xsl:value-of select="item/text()"/>
什么也没有返回。
我的XSLT是:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="item"/>
</body>
</html>
</xsl:template>
<xsl:template match="item">
<xsl:value-of select="text()"/>
</xsl:template>
</xsl:stylesheet>
我不知道还有什么类型提交我的编辑
这取决于当前的上下文是什么(即当前节点是什么)。在你的情况下,你必须定位在'item'元素的父项。您能否向我们展示您当前的XSLT,因为这会澄清事情。谢谢。 – 2013-04-21 18:56:25
你真的可以编辑你的问题来包含XSLT,而不是添加评论吗?谢谢! – 2013-04-21 19:03:49