Problem with preserving the format of xml element during xslt

Discussion in 'Java' started by longinus, Nov 12, 2004.

  1. longinus

    longinus Guest

    Hello,

    I have following element in XML:

    <Elem><![CDATA[dsdfhdfh<BR/>dfshdfhdfh
    dddd
    dddd<BR/>dsfhfdh<BR/>]]></Elem>

    which is preformatted and i would like to have the format on the
    webpage(html) as well.

    In XSL-file there is a following instructions:
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    ....>
    <PRE>
    <xsl:value-of select="Elem> diable-output-escaping="yes"/>
    </PRE>

    after XSLT preformatted text should preserve format on the webpage.

    What i get is:

    dsdfhdfh
    dfshdfhdfh
    dddd dddd
    dsfhfdh

    Where is the problem?

    Thanks,
    longinus
     
    longinus, Nov 12, 2004
    #1
    1. Advertising

  2. longinus

    Anton Spaans Guest

    "longinus" <> wrote in message
    news:...
    > Hello,
    >
    > I have following element in XML:
    >
    > <Elem><![CDATA[dsdfhdfh<BR/>dfshdfhdfh
    > dddd
    > dddd<BR/>dsfhfdh<BR/>]]></Elem>
    >
    > which is preformatted and i would like to have the format on the
    > webpage(html) as well.
    >
    > In XSL-file there is a following instructions:
    > <xsl:stylesheet version="1.0"
    > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    > ...>
    > <PRE>
    > <xsl:value-of select="Elem> diable-output-escaping="yes"/>
    > </PRE>
    >
    > after XSLT preformatted text should preserve format on the webpage.
    >
    > What i get is:
    >
    > dsdfhdfh
    > dfshdfhdfh
    > dddd dddd
    > dsfhfdh
    >
    > Where is the problem?
    >
    > Thanks,
    > longinus


    (i assume that there are some typo's in your original post)

    What do you want to see?
    If you do 'view source' on the html you probably will see this:
    ========================
    dsdfhdfh<BR/>dfshdfhdfh
    dddd
    dddd<BR/>dsfhfdh<BR/>
    ========================

    But in html, inside the browser, this will be shown as
    ========================
    dsdfhdfh
    dfshdfhdfh
    dddd dddd
    dsfhfdh
    ========================

    If you want to have this shown inside the browser:
    ========================
    dsdfhdfh<BR/>dfshdfhdfh
    dddd
    dddd<BR/>dsfhfdh<BR/>

    ========================
    then don't use <PRE>, but use an enclosing <XMP> element instead in your XSL
    (or <TEXTAREA>)

    -- Anton.
     
    Anton Spaans, Nov 12, 2004
    #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. Joe
    Replies:
    2
    Views:
    506
  2. Martin Plantec
    Replies:
    3
    Views:
    660
    Martin Plantec
    Oct 28, 2005
  3. chriscorbell
    Replies:
    2
    Views:
    463
  4. TTroy
    Replies:
    16
    Views:
    815
    Peter Nilsson
    Jan 31, 2005
  5. Replies:
    4
    Views:
    566
Loading...

Share This Page