我使用XPathBuilder 2.0.0.4转载它。 但是,我试过的XPath表达式在在线评估器中正常工作和评估(http://www.whitebeam.org/library/guide/TechNotes/xpathtestbed.rhtm)。
编辑:另外与Altova公司的XMLSpy的最新版本试图
输入:
<?xml version="1.0"?>
<asdf xmlns:xsi="n/a">
<Device xsi:type='EndDevice'/>
<Device xsi:type='EndDevice'/>
<Device xsi:type='EndDevice'/>
<Device xsi:type='EndDevice'/>
</asdf>
XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xsi="n/a">
<xsl:output indent="yes"/>
<xsl:template match="*">
<output>
<xsl:value-of select="count(//Device[@xsi:type = 'EndDevice'])"/>
</output>
</xsl:template>
</xsl:stylesheet>
输出:
<?xml version="1.0" encoding="UTF-8"?>
<output xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xsi="n/a">4</output>
我认为这是XPathBuilder这就是做一些事情错了。
你是什么意思,第二个“工作”?它与一些节点相匹配吗?您的XPath看起来是正确的,所以在您没有展示的代码段或您正在使用的工具中,某些内容不起作用。 – 2010-03-05 20:29:20