The entity "nbsp" was referenced, but not declared

14,633

You need to have the input declare the entities it uses, as done in http://xsltransform.net/gVhD8QR with e.g.

<!DOCTYPE test [
  <!ENTITY nbsp "&#160;">
]>
<test>The Spanish word for "Spain" is "Espa&nbsp;a" Dagon his Name, Sea Monster</test>

Note that the Spanish word for "Spain" is "España" however, so the example entity used there does not make sense there anyway.

Share:
14,633
Umaima
Author by

Umaima

Updated on June 04, 2022

Comments

  • Umaima
    Umaima almost 2 years

    I have written one XSLT to transform xml to xml.

    Input XML:

    <test>The Spanish word for "Spain" is "Espa&nbsp;a" Dagon his Name, Sea Monster</test>
    

    OutputXML:

    <test>The Spanish word for "Spain" is "Espa a" Dagon his Name, Sea Monster</test>
    

    XSL FILE: i have added the code for entity nbsp declaration under doctype at and replace with   entity but still are same error The entity "nbsp" was referenced, but not declared.

    <xsl:template match="test">
    <test>
      <xsl:apply-templates/>
    </test>
    

    • Martin Honnen
      Martin Honnen almost 7 years
      If you want to parse the input with an XML parser (and any XSLT processor normally uses an XML parser to parse the input document(s)) then the input itself needs to declare that entity in a DTD.
  • Umaima
    Umaima about 3 years
    Please share your email id because i'm stuck one problem and can't explain on 'stackoverflow' code is lenthy, please help me
  • Martin Honnen
    Martin Honnen about 3 years
    @Umaima, no, sorry, if StackOverflow doesn't work for you I can't help. There are certainly people doing freelance or contract work in the area of XSLT, if that is an option look for sides where you can post a work description and find people able and willing to do the work.