disable-output-escaping="yes" not working in Netscape or Opera ??


J

Joe Price

Hi all

I've formatted one of my xml files for viewing through a web browser
using xsl.
It works fine in Internet Explorer, however when I use Netscape6 or
Opera to view the same page the disable-output-escaping function does
not work and it is displaying html tags as text rather than code.

Can anyone enlighten me as to why this is happening?
Am i using the wrong namespace? i'm currently using:
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"

Can anyone explain to me a bit more about namespaces? why is there
different ones?

Many thanks for your input!
 
Ad

Advertisements

J

Johannes Koch

Joe said:
I've formatted one of my xml files for viewing through a web browser
using xsl.
It works fine in Internet Explorer, however when I use Netscape6 or
Opera to view the same page the disable-output-escaping function does
not work and it is displaying html tags as text rather than code.

From the XSLT 1.0 spec (16.4):
An XSLT processor is not required to support disabling output escaping.
Can anyone enlighten me as to why this is happening?
Am i using the wrong namespace? i'm currently using:
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"

Can anyone explain to me a bit more about namespaces? why is there
different ones?

Currently, there's only XSLT 1.0 with the namespace you are using. Well,
some old msxml versions use another namespace.

A better alternative would be, not to have HTML code inside CDATA
sections, but use XHTML embedded in your XML.
 
M

Martin Boehm

I've formatted one of my xml files for viewing through a web browser
using xsl.
It works fine in Internet Explorer, however when I use Netscape6 or
Opera to view the same page the disable-output-escaping function does
not work and it is displaying html tags as text rather than code.

Can anyone enlighten me as to why this is happening?

Not every XSL processor implements this feature, because it (obviously)
has the potential to produce malformed output. XSLT is meant to be a
side-effects-free programming language, so disable-output-escaping is
not a required part of an XSLT processor.

The favoured alternative for your case is to use well-formed XHTML as
part of the XML tree, so that you can avoid putting your code in CDATA
sections.
Am i using the wrong namespace?
No.

i'm currently using:
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
Correct.

Can anyone explain to me a bit more about namespaces? why is there
different ones?

Namespaces in XML are just what they are everywhere else - a method to
collate names in such way that their semantic meaning cannot be
misunderstood. You need namespaces as soon as there is the remote
possibility that someone chooses a name for something already existent
in the current scope. Like files in a file system. You cannot have two
files with the same name, they must at least be different in their path.
Think of a telephone book, or of DNS.

The namespace declaration
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" has three parts:
- the prefix "xmlns:"
- the name of your namespace, "xsl" in this case
- the URI of that namespace (every namespace needs a unique URI)

By prefixing the elements with their approriate namespace, like
<xsl:for-each>
you give them their meaning. Nothing keeps you from using <my:for-each>
elements, if you like. If you have declared it, of course:
xmlns:my=http://my.namespace.com

For more on namespaces:
http://www.google.com/search?q=XML+namespace+tutorial ;-)

HTH

Martin
 
R

Richard Tobin

Joe Price said:
It works fine in Internet Explorer, however when I use Netscape6 or
Opera to view the same page the disable-output-escaping function does
not work and it is displaying html tags as text rather than code.

You can only really expect disable-output-escaping to work when the
XSLT processor outputs XML. Output escaping is something that happens
when the tree resulting from the transform is converted into text, and
that doesn't happen in a web browser: the tree is interpreted as
[X]HTML, not output as text.

I'm surprised it worked in Internet Explorer.

-- Richard
 
J

Joe Price

Many thanks for your responses as they were really useful

Could you please point me in the right direction for tutorials on
embedding xhtml within an xml document?

many thanks
 
M

Mike Brown

Could you please point me in the right direction for tutorials on
embedding xhtml within an xml document?

XHTML is XML, so you are talking about embedding XML from one source into
another XML document. There are various ways to go about it, from slapping
together strings (with careful attention paid to encoding issues, if they're
not both Unicode) to DOM's importNode().

You are probably wondering how to first convert HTML to XHTML. For that, see
http://tidy.sourceforge.net/
 
Ad

Advertisements

J

Joe Price

This XML file i'm displaying through a web browser, I also load into
Flash.

If i was to write xhtml within my xml document - so that it would
display properly in netscape / opera etc - it would confuse the flash
parser as you have to specify which tag you want to extract content
from.

So, for example, just by adding a <p></p> tag to my xml file will mess
up the existing references to the xml tags within flash.

Any suggestions, solutions? Has anyone come across this problem
before?
 

Similar threads

J
Replies
2
Views
1K
Joe Kesselman
J
L
  • lakshmanavignesh
  • XML
Replies
0
Views
7K
lakshmanavignesh
L
T
  • Troot
  • XML
Replies
5
Views
3K
Troot
T
A
Replies
9
Views
3K
Peter Flynn
P
A
Replies
3
Views
2K
Martin Honnen
M
?
  • =?iso-8859-1?q?Eduardo_Y=E1=F1ez_Parareda?=
  • XML
Replies
3
Views
1K
Joe Kesselman
J
S
  • S2
  • XML
Replies
2
Views
2K
S2
S
H
Replies
9
Views
1K
harryajh
H
Top