[xsl] The entity was referenced, but not declared.

Subject: [xsl] The entity was referenced, but not declared.
From: "Manuel Souto Pico terminolator@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 12 Jun 2023 22:48:42 -0000
Dear all,

I'm trying to convert a collection of XLIFF files into TMX. The files
contain some HTML named entities, which makes my stylesheet choke:

Error on line 8 column 64 of file.xlf:
  SXXP0003   Error reported by XML parser: The entity "ndash" was
referenced, but not
  declared.: The entity "ndash" was referenced, but not declared.
Error
  SXXP0003  collection(): failed to parse XML file

file:/home/souto/Sync/PISA25/Assets/PISA2022/03_Preprocessed_MS/input_dir/file.xlf:
org.xml.sax.SAXParseException; systemId:
file:/home/souto/Sync/PISA25/Assets/PISA2022/03_Preprocessed_MS/input_dir/file.xlf;
lineNumber: 8; columnNumber: 64; The entity "ndash" was referenced, but not
declared.
collection(): failed to parse XML file
file:/home/souto/Sync/PISA25/Assets/PISA2022/03_Preprocessed_MS/input_dir/file.xlf:
org.xml.sax.SAXParseException; systemId:
file:/home/souto/Sync/PISA25/Assets/PISA2022/03_Preprocessed_MS/input_dir/file.xlf;
lineNumber: 8; columnNumber: 64; The entity "ndash" was referenced, but not
declared.

Even though the preamble of my stylesheet says:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE xsl:stylesheet [
    <!ENTITY ndash "&#x2013;" >
    <!ENTITY mdash "&#x2014;" >
]>
<xsl:stylesheet ...

My question is: Is there any way I can avoid or fix this problem from the
XSLT stylesheet without having to modify the input XLIFF files?

The example above is with ndash but I believe there must be many HTM named
entities in the files.

Thanks a lot in advance.
Cheers, Manuel

Current Thread