0
votes

I am stuck with this error when trying to convert xml file using SSIS with a 'XML task' using xslt:

[Tâche XML] Erreur : « An error occurred with the following error message: "La feuille de style doit commencer par un élément 'xsl:stylesheet' ou 'xsl:transform' ou par un élément de résultat littéral qui a un attribut 'xsl:version', le préfixe 'xsl' identifiant l'espace de noms 'http://www.w3.org/1999/XSL/Transform'.".

Here is the XLS file

   ***<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   <xsl:output method="xml" indent="yes"/>
   <xsl:template match="/">
      <RLUEx>
        <xsl:for-each select ="RLUEx">
           <RL0101Ax><xsl:value-of select="RL0101/RL0101x/RL0101Ax"/></RL0101Ax>
         </xsl:for-each>
       </RLUEx>
     </xsl:template>
     </xsl:stylesheet>***

As you can see, it begins with xsl:stylesheet as requested in error message

[1]: https://i.stack.imgur.com/GHsjX.png

1
Is it possible that you need to pass XSLT/XML file names properly to the SSIS XML Task? Please add a screen shot of it to your question.Yitzhak Khabinsky
I have added a screen shot of the taskMoujahed Hadj-Taieb

1 Answers

1
votes

As I expected, the XML and XSLT parameters should be switched.

Here is how SSIS XML Task, operation XSLT should be configured.

enter image description here

XSLT

You never shared the desired output. Here is my wild guess.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" indent="yes"/>
    <xsl:strip-space elements="*"/>

    <xsl:template match="/RL">
        <RLUEx>
            <xsl:for-each select="RLUEx">
                <r>
                    <RL0101Ex>
                        <xsl:value-of select="RL0101/RL0101x/RL0101Ex"/>
                    </RL0101Ex>
                    <RL0101Fx>
                        <xsl:value-of select="RL0101/RL0101x/RL0101Fx"/>
                    </RL0101Fx>
                    <RL0101Gx>
                        <xsl:value-of select="RL0101/RL0101x/RL0101Gx"/>
                    </RL0101Gx>
                </r>
            </xsl:for-each>
        </RLUEx>
    </xsl:template>
</xsl:stylesheet>