output method = text or html

Discussion in 'XML' started by Derek Fountain, Aug 13, 2003.

  1. Just asked a question regarding this little bit of XSL:

    ---
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:eek:utput method="html"/>

    <xsl:template match="/">
    <xsl:text>&apos; &lt; &gt; &quot; &amp;</xsl:text>
    </xsl:template>

    </xsl:stylesheet>
    ---

    When run I get:

    >xsltproc test1.xsl test1.xml

    ' &lt; &gt; &quot; &amp;

    i.e. the &lt; etc. aren't being converted to <, etc., (although the &apos;
    does).

    Someone told me to change the method="html" to method="text" and that indeed
    fixed the problem. My question now, is, why?

    My required final output is actually HTML (not XHTML, it's going into a
    legacy application which I can't re-engineer) so I need to be able to put
    out things like unclosed <p>'s and the like. If I put them directly in my
    XSL I get errors saying it's not a well formed document - which of course
    it isn't. If I use &lt;p&gt; then they don't get converted unless I use an
    output method of "text".

    Can someone help me understand what's happening here - either with an
    explanation or a URL I can read?
    Derek Fountain, Aug 13, 2003
    #1
    1. Advertising

  2. Derek Fountain wrote:
    > My required final output is actually HTML (not XHTML, it's going into a
    > legacy application which I can't re-engineer) so I need to be able to put
    > out things like unclosed <p>'s and the like.


    Why do you think you _need_ this? In HTML, the end tag of the p element
    is _optional_ but _not forbidden_.

    --
    Johannes Koch
    In te domine speravi; non confundar in aeternum.
    (Te Deum, 4th cent.)
    Johannes Koch, Aug 13, 2003
    #2
    1. Advertising

  3. Johannes Koch wrote:

    > Derek Fountain wrote:
    >> My required final output is actually HTML (not XHTML, it's going into a
    >> legacy application which I can't re-engineer) so I need to be able to put
    >> out things like unclosed <p>'s and the like.

    >
    > Why do you think you _need_ this? In HTML, the end tag of the p element
    > is _optional_ but _not forbidden_.


    The output of my XSL isn't going into an HTML renderer. Someone before my
    time had the bright idea to use HTML is a config file format, but only
    implemented enough of a parser to do the job required. This parser has its
    own ideas about what's optional and forbidden. In this case putting a
    closing </p> tag in confuses it.
    Derek Fountain, Aug 13, 2003
    #3
  4. On Wed, 13 Aug 2003 18:43:26 +0800, Derek Fountain wrote:


    >
    > <xsl:template match="/">
    > <xsl:text>&apos; &lt; &gt; &quot; &amp;</xsl:text>
    > </xsl:template>
    >
    > </xsl:stylesheet>
    > ---


    Try <xsl:text disable-output-escaping="yes"></xsl:text>
    to prevent characters from being escaped.

    --
    Patryk Dworznik
    Patryk Dworznik, Aug 13, 2003
    #4
    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. Andy Fish
    Replies:
    2
    Views:
    500
    Andy Fish
    Jun 15, 2004
  2. jaydog
    Replies:
    2
    Views:
    529
    jason schlachter
    Nov 9, 2004
  3. Xh
    Replies:
    7
    Views:
    1,049
    Joseph Kesselman
    Mar 19, 2007
  4. dmitrey
    Replies:
    0
    Views:
    1,058
    dmitrey
    Oct 14, 2008
  5. Kyung won Cheon
    Replies:
    0
    Views:
    185
    Kyung won Cheon
    Nov 21, 2008
Loading...

Share This Page