Go Back   Velocity Reviews > Newsgroups > XML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

XML - Re: Emitting   to HTML Output

 
Thread Tools Search this Thread
Old 06-24-2003, 10:21 AM   #1
Default Re: Emitting   to HTML Output


Johannes Koch wrote:

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

>
> <xslutput 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
  Reply With Quote
Old 06-24-2003, 05:42 PM   #2
Richard Tobin
 
Posts: n/a
Default Re: Emitting &nbsp; to HTML Output

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
><xslutput 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!
  Reply With Quote
Old 06-25-2003, 08:57 AM   #3
Johannes Koch
 
Posts: n/a
Default Re: Emitting &nbsp; to HTML Output

Richard Tobin wrote:
> In article <bd9d3a$qmlmt$>,
> Johannes Koch <> wrote:
>>No, I meant
>> 
>>and
>><xslutput 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.)

  Reply With Quote
Old 06-25-2003, 11:59 AM   #4
Klaus Johannes Rusch
 
Posts: n/a
Default Re: Emitting &nbsp; to HTML Output

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/


  Reply With Quote
Old 06-25-2003, 04:17 PM   #5
Johannes Koch
 
Posts: n/a
Default Re: Emitting &nbsp; to HTML Output

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.)

  Reply With Quote
Old 06-27-2003, 10:02 AM   #6
Micah Cowan
 
Posts: n/a
Default Re: Emitting &nbsp; to HTML Output

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 ?

> >
> > <xslutput 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
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump