Re: Emitting   to HTML Output

Discussion in 'XML' started by Klaus Johannes Rusch, Jun 24, 2003.

  1. Johannes Koch wrote:

    > Andy Dingley wrote:
    > > Assuming that I want _exactly_   what's the best/neatest way to
    > > do this ?

    >
    > <xsl:eek:utput encoding="us-ascii" .../>? (Untested)


    & is encoded as &amp; regardless of the encoding so this will not make any
    difference.

    If you really really really need to emit &nbsp; in the output, use

    <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>

    --
    Klaus Johannes Rusch

    http://www.atmedia.net/KlausRusch/
    Klaus Johannes Rusch, Jun 24, 2003
    #1
    1. Advertising

  2. In article <bd9d3a$qmlmt$>,
    Johannes Koch <> wrote:

    >>>Assuming that I want _exactly_ &nbsp; what's the best/neatest way to
    >>>do this ?


    ....

    >No, I meant

    >and
    ><xsl:eek:utput encoding="us-ascii" .../>


    That should ensure that it isn't output as a literal NBSP character,
    but is not likely to make it be output as &nbsp; instead of  

    -- Richard
    --
    Spam filter: to mail me from a .com/.net site, put my surname in the headers.

    FreeBSD rules!
    Richard Tobin, Jun 24, 2003
    #2
    1. Advertising

  3. Richard Tobin wrote:
    > In article <bd9d3a$qmlmt$>,
    > Johannes Koch <> wrote:
    >>No, I meant
    >> 
    >>and
    >><xsl:eek:utput encoding="us-ascii" .../>

    >
    >
    > That should ensure that it isn't output as a literal NBSP character,
    > but is not likely to make it be output as &nbsp; instead of  


    At least with Saxon 6.5.2 and Xalan-J 2.5.0 when outputting HTML, it does.
    --
    Johannes Koch
    In te domine speravi; non confundar in aeternum.
    (Te Deum, 4th cent.)
    Johannes Koch, Jun 25, 2003
    #3
  4. Johannes Koch wrote:

    > At least with Saxon 6.5.2 and Xalan-J 2.5.0 when outputting HTML, it does.


    That is the key point: when outputting HTML, an XSLT processor can use HTML
    entities, when outputting XML output it cannot, because there is no &nbsp;
    entity defined in XML.

    --
    Klaus Johannes Rusch

    http://www.atmedia.net/KlausRusch/
    Klaus Johannes Rusch, Jun 25, 2003
    #4
  5. Richard Tobin wrote:
    > In article <bdc0ei$r6rs7$>,
    > Johannes Koch <> wrote:
    >>So it is a solution for the OP's use case.

    >
    >
    > Yes, so long as you remember that it's implementation dependent.


    /me and the OP
    --
    Johannes Koch
    In te domine speravi; non confundar in aeternum.
    (Te Deum, 4th cent.)
    Johannes Koch, Jun 25, 2003
    #5
  6. Klaus Johannes Rusch

    Micah Cowan Guest

    Klaus Johannes Rusch <> writes:

    > Johannes Koch wrote:
    >
    > > Andy Dingley wrote:
    > > > Assuming that I want _exactly_ &nbsp; what's the best/neatest way to
    > > > do this ?

    > >
    > > <xsl:eek:utput encoding="us-ascii" .../>? (Untested)

    >
    > & is encoded as &amp; regardless of the encoding so this will not make any
    > difference.
    >
    > If you really really really need to emit &nbsp; in the output, use
    >
    > <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>


    Which may or may not work. I avoid that feature since you can't depend
    on it, and there's never a time (to my knowledge) that it's necessary
    for producing well-formed XML with the desired effect (unless the
    "desired effect" is defined to include the formatting of the source
    code, in which case you're better off post-processing it anyway).

    -Micah
    Micah Cowan, Jun 27, 2003
    #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. John Livermore

    Client side validators not emitting

    John Livermore, Jul 18, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    380
    John Livermore
    Jul 18, 2003
  2. Andy Jefferies

    Re: Emitting &nbsp; to HTML Output

    Andy Jefferies, Jun 25, 2003, in forum: XML
    Replies:
    0
    Views:
    1,331
    Andy Jefferies
    Jun 25, 2003
  3. Peter C. Chapin

    Re: Emitting &nbsp; to HTML Output

    Peter C. Chapin, Jun 26, 2003, in forum: XML
    Replies:
    10
    Views:
    3,548
    Micah Cowan
    Jun 28, 2003
  4. Paul Boddie
    Replies:
    0
    Views:
    1,341
    Paul Boddie
    Jun 24, 2003
  5. hotkitty

    Parsing CSV and "&nbsp;&nbsp;"

    hotkitty, Oct 9, 2008, in forum: Perl Misc
    Replies:
    9
    Views:
    322
Loading...

Share This Page