我无法从带名称空间的XML中选择节点值,但未获得任何值
我在尝试获取streetNumber的节点值时遇到了一个问题,该值位于命名空间XML中。下面是我的XML:我无法从带名称空间的XML中选择节点值,但未获得任何值,xml,xslt,xslt-2.0,Xml,Xslt,Xslt 2.0,我在尝试获取streetNumber的节点值时遇到了一个问题,该值位于命名空间XML中。下面是我的XML: <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" xmlns:tns
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" xmlns:tns="http://xsd.hometrack.com.au/pih/" xmlns:vms="http://www.sandstone-vms.com.au/schema/vms/1.0" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xs="http://wsdl.hometrack.com.au/pih/">
<soap:Body>
<xs:getPropertyResponse xmlns="http://wsdl.hometrack.com.au/pih/" xmlns:xs="http://wsdl.hometrack.com.au/pih/">
<pih xmlns="http://xsd.hometrack.com.au/pih/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<propertyResponse>
<property>
<address>
<streetNumber>32</streetNumber>
<streetName>SPARKLE</streetName>
</address>
</property>
</propertyResponse>
</pih>
</xs:getPropertyResponse>
</soap:Body>
</soap:Envelope>
我对此的XSLT是:
下面是我没有得到StreetNumber值的结果
<?xml version="1.0" encoding="UTF-8"?>
<response><output streetNumber=""/>
</response>
这方面的任何帮助都会对我有帮助。非常感谢 在XSLT中,需要定义那些名称空间,它们是XML格式的 XSLT: 鲁尔特:
<response><output streetNumber="32"/></response>
作为副本关闭;通过搜索XSLT默认名称空间,您可以找到成千上万的其他人提出了基本相同的问题。没有批评的意思:很多人都犯了这个错误。非常感谢。它工作得很好。嗨,Rudramuni,我上面的xml扩展了以下两条记录,我想根据它的日期(一个属性)对其进行排序。你能帮忙吗。
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xs="http://wsdl.hometrack.com.au/pih/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:template match="soap:Envelope/soap:Body">
<xsl:element name="response">
<xsl:element name="output">
<xsl:attribute name="streetNumber"><xsl:value-of select="xs:getPropertyResponse/*:pih/*:propertyResponse/*:property/*:address/*:streetNumber" /></xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
<response><output streetNumber="32"/></response>