xsl-list
[Top] [All Lists]

Re: Encoding/Entities problems

2002-10-29 11:07:55
Paulo (Shape.Tech) wrote:
i´m using mike´s exemple:

<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY % lat1 PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN"
"xhtml-lat1.ent">
<!ENTITY % symbol PUBLIC "-//W3C//ENTITIES Symbols for XHTML//EN"
"xhtml-symbol.ent">
<!ENTITY % special PUBLIC "-//W3C//ENTITIES Special for XHTML//EN"
"xhtml-special.ent">
%lat1;
%symbol;
%special;
]>

I got the .ent files and they´re saved in my local folder. in the browser
i´m getting this error:

O sistema não pode localizar o objeto especificado.
%lat1;

it means:  the system can´t locate the specified object.  %lat1;

Well that is just simply a "file not found" error. I cannot reproduce it,
myself. I put the .ent files in the same directory as the stylesheet, and it
worked fine. This is with IE6 / MSXML 3, no special security settings that I 
can recall.

MSXML does have a mode where it does not resolve external entities, and 
people have problems with this sometimes, but that's not what is happening 
here.

I do not recommend using the .ent files with full "http://www.w3.org/...";
references, because in this case, the browser really would go out over the
Internet to fetch the files.

As David Carlisle said, you can do the work manually; just copy the <!ENTITY>
declarations that you need from the files and use them instead of the
parameter entities. Note that standalone="no" is no longer needed if you do it
this way. And it will always work.

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY copy "&#169;">
<!ENTITY Delta "&#916;">
<!ENTITY dagger "&#8224;">
]>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

  <xsl:output method="html" indent="no"/>

  <xsl:template match="/">
    <html>
      <head>
        <title>test</title>
      </head>
      <body>
        <p>&copy;</p>
        <p>&Delta;</p>
        <p>&dagger;</p>
      </body>
    </html>
  </xsl:template>

</xsl:stylesheet>

Also, as David said, it's no more difficult to type "&#169;"...
Only use entities if they are really that much more convenient for you.

   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>