output formated text with xalan?

Discussion in 'XML' started by Elhanan, May 1, 2006.

  1. Elhanan

    Elhanan Guest

    hi..

    i don't exactly how to calls this , but is there a property for xalan,
    to output xml with crarriage return?

    i'm trying out xslt and the output can't be read with a normal editor,
    i know when serliaze xml with java, you can place a parameter saying
    the xml string will be output in human readble form.
    Elhanan, May 1, 2006
    #1
    1. Advertising

  2. Elhanan wrote:
    > i don't exactly how to calls this , but is there a property for xalan,
    > to output xml with crarriage return?


    xsl:eek:utput's intent attribute, possibly plus the xylem-specific
    xalan:indent-amount attribute for that element.

    Warning: The reason XSLT doesn't do this by default is that it may
    change the meaning of the document. Excercise appropriate care in using it.


    --
    Joe Kesselman / Beware the fury of a patient man. -- John Dryden
    Joseph Kesselman, May 1, 2006
    #2
    1. Advertising

  3. Joseph Kesselman wrote:
    > xsl:eek:utput's intent attribute, possibly plus the xylem-specific
    > xalan:indent-amount attribute for that element.


    Oops. Of course, "intent" should have been "indent"; apologies.

    The other solution, of course, is to write your stylesheet so it
    explicitly outputs whitespace at the desired places, eg via
    <xsl:text>
    </xsl:text>
    That has the advantage of being a lot more controllable than the indent
    directive (and more reliable, since different processors may interpret
    indent in somewhat different ways), but is more work for the stylesheet
    writer.

    --
    Joe Kesselman / Beware the fury of a patient man. -- John Dryden
    Joseph Kesselman, May 1, 2006
    #3
  4. Elhanan

    Elhanan Guest

    how can whitespace between elements change the meaning of the docuemnt?


    anyway all i wanna is to able to read it when i deubg.
    Elhanan, May 7, 2006
    #4
  5. Elhanan wrote:
    > how can whitespace between elements change the meaning of the docuemnt?


    There is no "between". All whitespace is contained within an element,
    and is part of that element's contained text. Depending on how your
    particularly markup language is being processed, and depending on what
    hints you give it (eg the xml:space directive, or schema information
    about the intended type), the system may be able to ignore the
    whitespace ... or may not.

    > anyway all i wanna is to able to read it when i deubg.


    For debugging, no problem, as long as you're aware that what you're
    seeing isn't exactly what other programs are seeing.

    For feeding it to another application, the only simple answer is It Depends.

    As long as you're aware of that, go for it.

    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
    Joe Kesselman, May 7, 2006
    #5
  6. Elhanan

    Peter Flynn Guest

    Elhanan wrote:
    > how can whitespace between elements change the meaning of the docuemnt?


    Because (depending on its context) it may be ignored or retained at
    processing time. This may make some data run together or be kept
    apart.

    See the FAQ: http://xml.silmaril.ie/authors/whitespace/

    > anyway all i wanna is to able to read it when i deubg.


    That may be all *you* want to do, but a machine doesn't have your
    eyes. All it can do is obey the markup and the rules of XML. That's
    why it's got to be correct. Just "looking OK" isn't enough.

    ///Peter
    --
    XML FAQ: http://xml.silmaril.ie/
    Peter Flynn, May 7, 2006
    #6
    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. cvissy
    Replies:
    0
    Views:
    601
    cvissy
    Nov 16, 2004
  2. sathyashrayan

    formated output excer (help)

    sathyashrayan, Feb 7, 2006, in forum: C Programming
    Replies:
    3
    Views:
    312
    Peter Shaggy Haywood
    Feb 9, 2006
  3. Carsten Fuchs
    Replies:
    5
    Views:
    494
    Carsten Fuchs
    Jul 8, 2008
  4. walterbyrd
    Replies:
    13
    Views:
    1,286
    walterbyrd
    May 13, 2009
  5. Michael
    Replies:
    2
    Views:
    242
    Michael
    Feb 17, 2006
Loading...

Share This Page