请问如何通过xsl给源xml数据加上namespace
tim90 2016-06-14 05:55:12 我用了xsl:template,但发现加布上去,求解
源数据如下,没有xmlns,所以引用了一个xsl 想强行把namespace加上去
<?xml-stylesheet type="text/xsl" href="xsl2.xsl"?>
<MortgageResults xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MonthlyPrincipalAndInterest>166.37927935617628</MonthlyPrincipalAndInterest>
<MonthlyTax>41.666666666666664</MonthlyTax>
<MonthlyTax>42.666666666666664</MonthlyTax>
<MonthlyInsurance>83.333333333333329</MonthlyInsurance>
<TotalPayment>291.37927935617626</TotalPayment>
</MortgageResults>
======================
xsl2.xsl 如下,想把xmlns="http://www.webserviceX.NET/" 加到上面那个xml里,但发现不管用
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<rdf:RDF>
<MortgageResults xmlns="http://www.webserviceX.NET/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:kk="http://www.w3.org/2001/">
<MonthlyPrincipalAndInterest><xsl:value-of select="MortgageResults/MonthlyPrincipalAndInterest"/></MonthlyPrincipalAndInterest>
<xsl:for-each select="MortgageResults/MonthlyTax">
<MonthlyTax><xsl:value-of select="self::*"/></MonthlyTax>
</xsl:for-each>
<MonthlyInsurance><xsl:value-of select="MortgageResults/MonthlyInsurance"/></MonthlyInsurance>
<TotalPayment><xsl:value-of select="MortgageResults/TotalPayment"/></TotalPayment>
</MortgageResults>
</rdf:RDF>
</xsl:template>
</xsl:stylesheet>
谢谢