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

Discussion in 'XML' started by Joe Price, Sep 25, 2003.

  1. Joe Price

    Joe Price Guest

    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!
     
    Joe Price, Sep 25, 2003
    #1
    1. Advertising

  2. Re: disable-output-escaping="yes" not working in Netscape or Opera??

    Joe Price wrote:
    > 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.
    --
    Johannes Koch
    In te domine speravi; non confundar in aeternum.
    (Te Deum, 4th cent.)
     
    Johannes Koch, Sep 25, 2003
    #2
    1. Advertising

  3. Joe Price

    Martin Boehm Guest

    "Joe Price" <> wrote in message
    news:

    > 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
     
    Martin Boehm, Sep 25, 2003
    #3
  4. In article <>,
    Joe Price <> wrote:

    >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
    --
    Spam filter: to mail me from a .com/.net site, put my surname in the headers.

    FreeBSD rules!
     
    Richard Tobin, Sep 25, 2003
    #4
  5. Joe Price

    Joe Price Guest

    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
     
    Joe Price, Sep 26, 2003
    #5
  6. Joe Price

    Mike Brown Guest

    > 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/
     
    Mike Brown, Sep 26, 2003
    #6
  7. Joe Price

    Joe Price Guest

    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?
     
    Joe Price, Sep 26, 2003
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lisa
    Replies:
    1
    Views:
    6,135
    Martin Honnen
    Jul 7, 2004
  2. Troot

    disable-output-escaping

    Troot, Mar 1, 2006, in forum: XML
    Replies:
    5
    Views:
    2,652
    Troot
    Mar 2, 2006
  3. teo
    Replies:
    3
    Views:
    548
  4. David Henderson
    Replies:
    3
    Views:
    3,290
    Jerinaw
    Dec 30, 2010
  5. Jamie Herre
    Replies:
    1
    Views:
    209
    why the lucky stiff
    Jan 7, 2005
Loading...

Share This Page