1
我不知道为什么这不起作用。xsl导航似乎不工作
这里是我的xml:
<s:Body xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<LoginBodyResponse xmlns="http://tempuri.org">
<LoginBodyResult>somettext</LoginBodyResult>
</LoginBodyResponse>
</s:Body>
这里是我当前的xsl:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var"
exclude-result-prefixes="msxsl var s0"
version="1.0"
xmlns:ns0="http://tempuri.org"
xmlns:s0="http://tempuri.org">
<xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
<xsl:template match="LoginBodyResponse">
<ns0:LoginBodyReponse>
<xsl:if test="LoginBodyResult">
<LoginBodyResult>
<xsl:value-of select="LoginBodyResult/text()" />
</LoginBodyResult>
</xsl:if>
</ns0:LoginBodyReponse>
</xsl:template>
</xsl:stylesheet>
我不能让它进入这个模板。我真的不确定为什么它不会去LoginBodyResponse节点。我认为我犯了一个愚蠢的小错误,但无法弄清楚它是个问题。我也将模板匹配设置为* /,当我这样做时,它无法在xsl:if部分中找到LoginBodyResult。
我基本上是在寻找这样的输出:
<ns0:LoginBodyReponse xmlns:ns0="http://tempuri.org">
<LoginBodyResult>somettest</LoginBodyResult>
</ns0:LoginBodyReponse>
duh。就是这样。谢谢!另外,tempuri.org并不是我的xsl的样子。我只是改变它来隐藏我的真实命名空间在这里。 –