具有默認(rèn)命名空間設(shè)置為xmlns的xml源的xslt。我有一個(gè)XML文檔,它的默認(rèn)名稱空間指示在根目錄下。就像這樣:<MyRoot xmlns="http://www.mysite.com">
<MyChild1>
<MyData>1234</MyData>
</MyChild1> </MyRoot>由于默認(rèn)的命名空間,解析XML的XSLT不能按預(yù)期工作,也就是說(shuō),當(dāng)我刪除名稱空間時(shí),一切都按預(yù)期工作。以下是我的XSLT:<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:template match="/" >
<soap:Envelope xsl:version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<NewRoot xmlns="http://wherever.com">
<NewChild>
<ChildID>ABCD</ChildID>
<ChildData>
<xsl:value-of select="/MyRoot/MyChild1/MyData"/>
</ChildData>
</NewChild>
</NewRoot>
</soap:Body>
</soap:Envelope>
</xsl:template></xsl:stylesheet>對(duì)于XSLT文檔,需要做些什么才能使翻譯正常工作?在XSLT文檔中到底需要做什么?
具有默認(rèn)命名空間設(shè)置為xmlns的xml源的xslt。
www說(shuō)
2019-06-21 13:11:27