简体   繁体   中英

Namespace prefix xsl on value-of is not defined

I must transform xml2xml. I have an XSLT file that works fine with other XML files and I adapt it to the followed file (just a test file) :

<?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>

and then XSLT file :

    <?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>

I have a warning : Impossible de transformer : Error at line 13, column 28: Namespace prefix xsl on value-of is not defined

what can I do ?

Start by changing this:

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

to:

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

But you have numerous other issues that this correction will expose.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM