XSLT大師,XSLT文檔()函數結果包含不受歡迎的xmlns = 「」
我有一個包括不想要的的xmlns =一個XSLT 「輸出」。我已經多次在網站上看到過這個問題和問題,但我似乎無法得到任何答案來爲我正在做的事情工作。我必須警告你,我是XSLT的新手,但並不擅長。
我的XSLT從調用它的應用程序中收集一組數據,然後還使用document()來獲取其他數據。這一切工作正常,我只需要擺脫的xmlns =「」
通過文件()調用XML是
<?xml version="1.0" encoding="UTF-8"?><BiExport xmlns="">
<ExportData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Phone>8885551212</Phone>
<ClientRefCmtSuffix/>
<UDFData>
<DictionaryEntry>
<Key xsi:type="xsd:string">MyCompany Completed Date</Key>
<Value xsi:type="xsd:string">06/24/2013</Value>
</DictionaryEntry>
<DictionaryEntry>
<Key xsi:type="xsd:string">Rush</Key>
<Value xsi:type="xsd:string">0</Value>
</DictionaryEntry>
<DictionaryEntry>
<Key xsi:type="xsd:string">Suffix</Key>
<Value xsi:type="xsd:string">0000000000</Value>
</DictionaryEntry>
</UDFData>
<ReportCreateDate>2014-09-26T15:45:48.83952-07:00</ReportCreateDate>
</ExportData>
</BiExport>
是的,我知道它有<BiExport xmlns="">
,不,我可以的不會改變這一點,即使在應用我的XSLT之前將其刪除,它也沒有什麼區別。
我的XSLT是
<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:bean="http://www.MyCompany.com/eventgenerator/beans">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="no" />
<xsl:variable name="ReportCreateDate" select="bean:FileEvent/bean:Context[@Id='XPathStep']/bean:Item[@Name='ReportCreateDate']/@Value"/>
<xsl:variable name="PDFFile" select="concat($PDFFilename, '.', $PDFFileExt)"/>
<xsl:variable name="InputFile" select="bean:FileEvent/bean:Context[@Id='XPathStep']/bean:Item[@Name='InputFile']/@Value"/>
<xsl:variable name="PDFFilename" select="bean:FileEvent/bean:Context[@Id='XSLTStep']/bean:Item[@Name='PDFFilename']/@Value"/>
<xsl:variable name="InputFilePath" select="bean:FileEvent/bean:Context[@Id='ArchiveMessageStep']/bean:Item[@Name='ArchiveDirectory']/@Value"/>
<xsl:variable name="InputFileString" select="concat($InputFilePath, '\', $PDFFilename, '.xml')"/>
<xsl:template name="UDFs" match="document($InputFileString)/BiExport/ExportData/UDFData/DictionaryEntry">
<xsl:param name="pKey" select="." />
<Item name="{$pKey}">
<xsl:value-of select="../Value"/>
</Item>
</xsl:template>
<xsl:template match="/">
<MDXPackage version="1.0" xmlns="http://www.MyCompany.com/schemas">
<Payload>
<PayloadContext>
<xsl:apply-templates select="document($InputFileString)/BiExport/ExportData/UDFData/DictionaryEntry/Key" />
<xsl:choose>
<xsl:when test="string($ReportCreateDate)">
<Item name="ReportCreateDate">
<xsl:value-of select="$ReportCreateDate"/>
</Item>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="string($PDFFile)">
<Item name="PDFFile">
<xsl:value-of select="$PDFFile"/>
</Item>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
<!-- more of the same follows-->
</PayloadContext>
</Payload>
</MDXPackage>
</xsl:template>
</xsl:stylesheet>
和輸出是理解提前任何幫助
<MDXPackage xmlns="http://www.mitchell.com/schemas" version="1.0">
<Payload>
<PayloadContext>
<Item xmlns="" name="MyCompany Completed Date">06/24/2013</Item>
<Item xmlns="" name="Rush">0</Item>
<Item xmlns="" name="Suffix">0000000000</Item>
<Item name="ReportCreateDate">2014-09-26T13:53:28.3831684-07:00</Item>
<Item name="ClaimantPhone">8885551212</Item>
</PayloadContext>
</Payload>
</MDXPackage>
謝謝爲什麼我得到空的命名空間聲明,以及如何擺脫它。
DL
輸入文檔中的內容(您正在應用該轉換的XML文檔)是什麼? – 2014-09-26 23:28:12