Hi Shruthi,
    Within the XSL stylesheet and/or XML document that you've provided
within mail below, there is no definition for entity name eacute.

I think, therefore the error message that you've reported is expected
and is not a bug.

On Tue, Apr 14, 2026 at 10:22 AM Shruthi . <[email protected]> wrote:
> If I understand correctly, with your suggestion &eacute; will be replaced 
> with "Hello" before transformation and the XSLT will not throw any issue. But 
> that doesn't seem to resolve our issue.
>
> Please find the testcase below.
>
> EmojiInput.xml
> <Order DocumentType="0001" DraftOrderFlag="N" EnterpriseCode="IBM" 
> EntryType="Web" OrderNo="" OrderDate="" SellerOrganizationCode="IBM" 
> BuyerOrganizationCode="" ReqDeliveryDate="" ReqShipDate="">
> <OrderLines>
> <OrderLine OrderedQty="1" PrimeLineNo="1" SubLineNo="1">
> <Item ItemID="IBMItem10" UnitOfMeasure="EACH" ProductClass="Good" 
> ItemShortDesc="75 compléments premium et appétissants au poulet 300 gr"/>
> </OrderLine>
> </OrderLines>
> <PersonInfoShipTo Country="US"/>
> <PersonInfoBillTo Country="US"/>
> </Order>
>
>
> Test_html.xsl
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
> version="1.0">
> <xsl:output method="html" encoding="UTF-8" indent="yes"/>
> <!-- Root template -->
> <xsl:template match="/">
> <xsl:apply-templates select="Order"/>
> </xsl:template>
> <!-- Match Order element -->
> <xsl:template match="Order">
> <Order>
> <xsl:copy-of select="@*"/>
> <xsl:apply-templates select="OrderLines"/>
> <xsl:apply-templates select="PersonInfoShipTo"/>
> <xsl:apply-templates select="PersonInfoBillTo"/>
> </Order>
> </xsl:template>
> <!-- Match OrderLines -->
> <xsl:template match="OrderLines">
> <OrderLines>
> <xsl:apply-templates select="OrderLine"/>
> </OrderLines>
> </xsl:template>
> <!-- Match each OrderLine and modify Item -->
> <xsl:template match="OrderLine">
> <OrderLine>
> <xsl:copy-of select="@*"/>
> <xsl:apply-templates select="Item"/>
> </OrderLine>
> </xsl:template>
> <!-- Match Item and copy ItemShortDesc into ManufacturerItemDesc -->
> <xsl:template match="Item">
> <Item>
> <xsl:copy-of select="@*"/>
> <xsl:attribute name="ManufacturerItemDesc">
> <xsl:value-of select="@ItemShortDesc"/>
> </xsl:attribute>
> </Item>
> </xsl:template>
> <!-- Copy PersonInfoShipTo and PersonInfoBillTo as-is -->
> <xsl:template match="PersonInfoShipTo | PersonInfoBillTo">
> <xsl:copy>
> <xsl:copy-of select="@*"/>
> </xsl:copy>
> </xsl:template>
> </xsl:stylesheet>
>
>
> HTMLEntityParsingTest.java
> import java.io.ByteArrayInputStream;
> import java.io.ByteArrayOutputStream;
> import java.io.FileInputStream;
>
> import javax.xml.parsers.DocumentBuilder;
> import javax.xml.parsers.DocumentBuilderFactory;
> import javax.xml.transform.Result;
> import javax.xml.transform.Source;
> import javax.xml.transform.Transformer;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.stream.StreamResult;
> import javax.xml.transform.stream.StreamSource;
>
> import org.w3c.dom.Document;
>
> public class HTMLEntityParsingTest
> {
>     public static void main(String[] args)
>     {
>         try
>         {
>             Source xmlSource = new StreamSource(new 
> FileInputStream("EmojiInput.xml"));
>
>             Source xslSource = new StreamSource(new 
> FileInputStream("Test_html.xsl"));
>
>             TransformerFactory transformerFactory = 
> TransformerFactory.newInstance();
>             Transformer transformer = 
> transformerFactory.newTransformer(xslSource);
>
>             ByteArrayOutputStream baos = new ByteArrayOutputStream();
>             Result result = new StreamResult(baos);
>
>             transformer.transform(xmlSource, result);
>
>             byte[] transformedOutput = baos.toByteArray();
>
>             DocumentBuilderFactory factory = 
> DocumentBuilderFactory.newInstance();
>             factory.setNamespaceAware(true);
>             DocumentBuilder builder = factory.newDocumentBuilder();
>
>             Document doc = builder.parse(new 
> ByteArrayInputStream(transformedOutput));
>         }
>         catch (org.xml.sax.SAXParseException e)
>         {
>             e.printStackTrace();
>             System.exit(1);
>         }
>         catch (Exception e)
>         {
>             e.printStackTrace();
>             System.exit(1);
>         }
>     }
> }
>
>
> Failure:
> [Fatal Error] :4:98: The entity "eacute" was referenced, but not declared.
> org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 98; The entity 
> "eacute" was referenced, but not declared.
>         at 
> com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
>         at 
> com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:338)
>         at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121)
>         at HTMLEntityParsingTest.main(HTMLEntityParsingTest.java:40)
>
>
> Thanks
> Shruthi



-- 
Regards,
Mukul Gandhi

Reply via email to