空命名空间的XPath查询xmlns =“”

时间:2009-07-27 08:33:06

标签: xpath xml-namespaces

我使用什么XPath来查询下面xml中的info节点?我在XMLSpy中尝试了不同的表达式,但没有任何作用。

<root xmlns="tempuri.org" xmlns:p="http://nonamespace.org/std/Name/2006-10-18/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<item xmlns="">
    <info>blah blah</info>
    <date>2009-07-27 00:00:00</date>
</item>

1 个答案:

答案 0 :(得分:0)

你可以这样做

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="tempuri.org">

<xsl:template match="/">
     <xsl:value-of select="a:root/item/info"/>
</xsl:template>