xsl-list
[Top] [All Lists]

Re: Encoding/Entities problems

2002-10-29 11:18:31
Hi people, finaly it´s working :))))
a guy in Microsoft XML Web Release Public Newsgroup told me what do to.

read it:
------------

Hi Paulo,

If you are using a DTD to define some entities then that DTD will not allow
the entire document to be validated - which is what the DOM will be trying
to do.

To stop the DOM from automatically trying to validate the XML document on
parsing set the .validateOnParse property to false prior to loading.

----------

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE xsl:stylesheet SYSTEM "entidades.ent">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
 <xsl:output method="html" indent="no"/>

and the  entidades.ent file is:


----- Original Message -----
From: "Mike Brown" <mike(_at_)skew(_dot_)org>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Tuesday, October 29, 2002 4:07 PM
Subject: Re: [xsl] Encoding/Entities problems


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




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



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