2017-08-01 75 views
0

我必須轉換xml2xml。我有一個XSLT文件,與其他XML文件工作正常,我也適應被跟隨文件(只是一個測試文件):名稱空間前綴xsl on value-of未定義

<?xml version="1.0" encoding="UTF-8"?> 
<invoice:request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:invoice="http://www.xmlData.ch/xmlInvoice/XSD" 
    xsi:schemaLocation="http://www.xmlData.ch/xmlInvoice/XSD 
    MDInvoiceRequest_400.xsd" role="production"> 

    <invoice:prolog> 
    <invoice:package>Handy patients</invoice:package> 
    <invoice:software>Handy patients</invoice:software> 
    <invoice:validator>tarmedValidator100 ATL Module Copyright © by Suva &amp; santésuisse</invoice:validator> 
    </invoice:prolog> 

    <invoice:invoice invoice_id="23"> 
    <invoice:balance> 
     <invoice:vat>0.00</invoice:vat> 
    </invoice:balance> 
    <invoice:detail> 
     <invoice:services> 
     <invoice:record_tarmed>Prestation médicale en l'absence du patient (y compris étude de dossier), par période de 5 min 
     </invoice:record_tarmed> 
     <invoice:record_tarmed>Rapport médical sur formulaire assurance-maladie, {AA}, {AM}/Rapport intermédiaire/Feuille annexe sur formulaire {AI} 
     </invoice:record_tarmed> 
     </invoice:services> 
    </invoice:detail> 
    </invoice:invoice> 

然後XSLT文件:

<?xml version="1.0" encoding="UTF-8"?> 

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/2001/XMLSchema-instance"> 

    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> 

    <xsl:template match="invoice:request"> 
    <xsl:copy> 
     <xsl:for-each-group select="invoice:invoice " group-by="@invoice_id"> 
     <xsl:element name="Facture"> 
      <xsl:for-each select="current-group()"> 
      <xsl:element name="Package"> 
       <xsl:value-of select="../invoice:prolog/invoice:package"/> 
      </xsl:element> 
      </xsl:for-each> 
     </xsl:element> 
     </xsl:for-each-group> 
    </xsl:copy> 
    </xsl:template> 

</xsl:stylesheet> 

我有一個警告:不可能變壓器:錯誤在第13行,第28列:名稱空間前綴xsl on value-of未定義

我該怎麼辦?

+0

您的樣式表被標記爲'version =「1.0」'但'xsl:for-each-group'需要XSLT 2.0。你的處理器是否支持它? –

+0

感謝您的建議。我做了這兩個改變,但結果是一樣的。我還可以做些什麼 ? –

+0

** 1。**結果是**不相同。由於'invoice:'前綴未聲明,您應該看到不同的錯誤消息。 - ** 2。**您沒有回答我的問題:您的處理器是否支持XSLT 2.0?更改樣式表上的版本與此無關。 –

回答

0

開始通過改變這樣的:

xmlns:xsl="http://www.w3.org/2001/XMLSchema-instance" 

到:

xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 

但是你有大量的其他問題,這種修正將暴露。

+0

我已添加此聲明: 但結果是一樣的 –

相關問題