XML text to HTML

Discussion in 'XML' started by Son KwonNam, Jan 20, 2005.

  1. Son KwonNam

    Son KwonNam Guest

    When I have XML text data like the following..
    ------ XML Snippet -----
    <TEXT>
    Hello,
    XML &amp; Java Newsgroup!
    </TEXT>
    ------------------------

    I hope to get the following html
    ------- HTML Sinppet -----
    Hello,<BR/>
    XML&nbsp;&amp;&nbsp;Java&nbsp;Newsgroup!<BR/>
    --------------------------

    I tried a java extension, which just replaces &,whitespace and new
    line(\n) to their corresponding html elements
    then, get the text from the method with

    <xsl:value-of select="tth:textToHtml(.)"/>

    But failed, because Xalan prints html like
    -------------------------
    Hello,&lt;BR/&gt;
    XML&amp;nbsp;&amp;amp;&amp;nbsp;Java&amp;nbsp;Newsgroup!&lt;BR/&gt;
    --------------------------

    I use Xalan for transforming.
    How can I get the correct html from xml text?

    Regards,
    KwonNam.
    Son KwonNam, Jan 20, 2005
    #1
    1. Advertising

  2. Son KwonNam

    Son KwonNam Guest

    The answer is

    <xsl:value-of select="tth:textToHtml(.)" disable-output-escaping="yes"/>

    :)

    Son KwonNam ¾´ ±Û:
    > When I have XML text data like the following..
    > ------ XML Snippet -----
    > <TEXT>
    > Hello,
    > XML &amp; Java Newsgroup!
    > </TEXT>
    > ------------------------
    >
    > I hope to get the following html
    > ------- HTML Sinppet -----
    > Hello,<BR/>
    > XML&nbsp;&amp;&nbsp;Java&nbsp;Newsgroup!<BR/>
    > --------------------------
    >
    > I tried a java extension, which just replaces &,whitespace and new
    > line(\n) to their corresponding html elements
    > then, get the text from the method with
    >
    > <xsl:value-of select="tth:textToHtml(.)"/>
    >
    > But failed, because Xalan prints html like
    > -------------------------
    > Hello,&lt;BR/&gt;
    > XML&amp;nbsp;&amp;amp;&amp;nbsp;Java&amp;nbsp;Newsgroup!&lt;BR/&gt;
    > --------------------------
    >
    > I use Xalan for transforming.
    > How can I get the correct html from xml text?
    >
    > Regards,
    > KwonNam.
    Son KwonNam, Jan 20, 2005
    #2
    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. Guest
    Replies:
    0
    Views:
    554
    Guest
    Feb 20, 2004
  2. Damon Payne
    Replies:
    0
    Views:
    9,134
    Damon Payne
    Mar 8, 2005
  3. Replies:
    1
    Views:
    3,972
    =?Utf-8?B?Rng=?=
    Aug 16, 2005
  4. Saya
    Replies:
    0
    Views:
    623
  5. Jesús Bosch
    Replies:
    1
    Views:
    13,057
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Jul 3, 2006
Loading...

Share This Page