xmlxsltxslt-1.0

xsltproc gives error xmlAddEntity: invalid redeclaration of predefined entity


Since some time, running xsltproc (libxml 20913, libxslt 10134 and libexslt 820) gives me an error I didn't have before:

error: xmlAddEntity: invalid redeclaration of predefined entity

More than an error, it behaves like a warning because the xsltproc processor goes on compiling and produces the right output.

I would like to get rid of this warning or error but the problem is I have a certain amount of files with many entities declared, not only in the XML files but also in the XSL style sheets, and the error message doesn't mention the file where the redeclaration occurs and which entity is redeclared.

Removing random entities, apart from breaking my code, sometimes but not always result in no less error messages.

I can't reproduce this error with a MWE (the MWE I try to build gives no error), and the current full code (XSL and XML) counts 30K lines.

Any pointer to a solution would be appreciated.


Solution

  • The problem resides in the XSL files where there is no need to declare amp ('&') and lt ('<').

    Removing all the lines containing

    <!ENTITY amp "&#x0026;">
    

    or

    <!ENTITY lt "&#x003C;">
    

    from the XSL style sheets will suppress the error. These entities are already declared by default.