Xml 没有从该xslt返回任何结果
我有来自Web服务的xml输出:Xml 没有从该xslt返回任何结果,xml,xslt,transformation,xml-namespaces,Xml,Xslt,Transformation,Xml Namespaces,我有来自Web服务的xml输出: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <FLNewIndividualID xm
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<FLNewIndividualID xmlns="http://www.test.com/wsdl/TTypes">
<ObjectType>C1</ObjectType>
<ObjectReference>101000216193</ObjectReference>
<ObjectReference xsi:nil="true"/>
<ObjectReference xsi:nil="true"/>
</FLNewIndividualID>
</soapenv:Body>
</soapenv:Envelope>
C1
101000216193
我正在尝试提取ObjectType和ObjectReference
所以我有了这个XSLT
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:nsl="http://www.test.com/wsdl/TTypes"
xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/env:Envelope/env:Body/nsl:FLNewIndividualID">
<xsl:value-of select="ObjectType"/>-<xsl:value-of select="ObjectReference"/>
</xsl:template>
</xsl:stylesheet>
-
我只是
<?xml version="1.0" encoding="utf-8"?>
结果
如果我将空白属性添加到结果xmlns=“”
例如
C1
101000216193
然后它工作了,我得到:
<?xml version="1.0" encoding="utf-8"?>
C1-101000216193
C1-101000216193
有什么想法吗?我无法更改XML输出 该
有一个默认名称空间集,因此其子项继承该名称空间
试一试
(当然,此示例不会生成格式良好的XML)
<?xml version="1.0" encoding="utf-8"?>
C1-101000216193
<xsl:value-of select="nsl:ObjectType" />
<xsl:text>-</xsl:text>
<xsl:value-of select="nsl:ObjectReference" />
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:nsl="http://www.test.com/wsdl/TTypes"
exclude-result-prefixes="env nsl"
>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="nsl:FLNewIndividualID">
<xsl:value-of select="concat(nsl:ObjectType, '-', nsl:ObjectReference)" />
</xsl:template>
<xsl:template match="text()" />
</xsl:stylesheet>