我想从下面的 XML 中获取“LIVE”。我读过类似的帖子,因此一直在使用 local-name() 函数,但无论我使用什么 XSLT,我都无法获得它。
<?xml version="1.0"?>
<cns:customer xmlns:cns="https://services.cns.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://services.cns.com docs/xsd/customer.xsd">
    <cns:userId>1001</cns:userId>
    <cns:status>LIVE</cns:status>
    <cns:type wholesale="true" suspended="false">W1</cns:type>
    <cns:properties>
        <cns:property>
            <cns:name>Name</cns:name>
            <cns:value>Bob</cns:value>
        </cns:property>
    </cns:properties>
</cns:customer>
这是我正在使用的 XSLT。
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text" encoding="UTF-8"/>
    <xsl:template match="//*[local-name()='status']/text()">
        <xsl:value-of select="."/>
    </xsl:template>
</xsl:stylesheet>
我正在使用 Oxygen 应用程序进行测试。我认为处理器是 Saxon 6.5.5。
我得到的输出是:
1001
LIVE
W1
    Name
    Bob
谢谢,保罗