473,387 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

[XSL XHTML]   entity problem

In XHTML the entity nbsp stands for  

A normal space like " " is also displayed as an normal space,
but multiple spaces like " " are interpreted as 1 space in the
xhtml page.
So there comes the   in handy: with "  " you have two
spaces. So with the nbsp entity you can create multiple spaces (in the display).

Now i have an xml file with   entities,
i put it in an xsl-file that know xhtml entities.
But the output of this:

"  "

is translated (correctly) to:

" "

But now the whole point of the   entity in xhtml is gone!!
How do you solve this problem
Jul 20 '05 #1
12 5987
In article <42***********************@news.wanadoo.nl>,
Tjerk Wolterink <tj***@wolterinkwebdesign.com> wrote:

&nbsp; is defined as   which is a reference to the
non-breaking-space character. If you have a way to type it in, you
can perfectly well use that character directly instead of using an
entity or reference, and it is different from an ordinary space
character even though it may look the same when you look at the file.
"&nbsp;&nbsp;"

is translated (correctly) to:

" "


So those blank spaces between the quotes should be perfectly good
non-breaking-space characters, not ordinary spaces, and should work
just like &nbsp; references in XHTML.

-- Richard
Jul 20 '05 #2
Richard Tobin wrote:
In article <42***********************@news.wanadoo.nl>,
Tjerk Wolterink <tj***@wolterinkwebdesign.com> wrote:

&nbsp; is defined as   which is a reference to the
non-breaking-space character. If you have a way to type it in, you
can perfectly well use that character directly instead of using an
entity or reference, and it is different from an ordinary space
character even though it may look the same when you look at the file.

"&nbsp;&nbsp;"

is translated (correctly) to:

" "

So those blank spaces between the quotes should be perfectly good
non-breaking-space characters, not ordinary spaces, and should work
just like &nbsp; references in XHTML.

-- Richard


so you mean that " " and " " can be different characters?
Jul 20 '05 #3
In article <42**********************@news.wanadoo.nl>,
Tjerk Wolterink <tj***@wolterinkwebdesign.com> wrote:
so you mean that " " and " " can be different characters?


Yes, Unicode has several different characters that may look like that.

-- Richard
Jul 20 '05 #4
Richard Tobin wrote:
In article <42**********************@news.wanadoo.nl>,
Tjerk Wolterink <tj***@wolterinkwebdesign.com> wrote:

so you mean that " " and " " can be different characters?

Yes, Unicode has several different characters that may look like that.

-- Richard


i have foudn a smart solution:

<!DOCTYPE stylesheet [
<!ENTITY nbsp
"<xsl:text disable-output-escaping='yes'>&amp;nbsp;</xsl:text>">
]>

now it works
Jul 20 '05 #5
In article <42***********************@news.wanadoo.nl>,
Tjerk Wolterink <tj***@wolterinkwebdesign.com> wrote:
now it works


It should have worked anyway!

-- Richard

Jul 20 '05 #6


Tjerk Wolterink wrote:
i have foudn a smart solution:

<!DOCTYPE stylesheet [
<!ENTITY nbsp
"<xsl:text disable-output-escaping='yes'>&amp;nbsp;</xsl:text>">
]>


Use it if your circumstances allow it and require it but be aware that
disable-output-escaping is an optional feature that is not supported by
every XSLT processor respectively output mode, for instance when the
result of the transformation is a tree that is not serialized then it
usually doesn't work.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #7
Richard Tobin wrote:
In article <42***********************@news.wanadoo.nl>,
Tjerk Wolterink <tj***@wolterinkwebdesign.com> wrote:
now it works

It should have worked anyway!

-- Richard


i know what you mean, maybe the output document is valid and the " " is really a
non breaking space. the fact is that browsers like IE do not treat it like that.

But anyways, thanks for your help
Jul 20 '05 #8
Tjerk Wolterink <tj***@wolterinkwebdesign.com> wrote:
i know what you mean, maybe the output document is valid
How would validity be relevant here? (I suspect you are using the word
"valid" in some non-XML and not-so-well defined meaning.)
and the " " is really a non breaking space.
No, what you have typed here is surely a normal space. You could not
have included a no-break space (that's the term, btw) into your
posting, since your message headers specify 7bit transfer.

I wonder why you use &nbsp; in the first place. Why don't you simply
write no-break spaces in whatever encoding you are using? If your
authoring tool does not let you type them easily, maybe you need a
better tool, or to find out how to define keyboard macros in the tool
you are using, or something. Even in Notepad you can type no-break
spaces. (Typing Alt 0160 is not very convenient, but it's comparable to
typing the six characters &nbsp;.)
the fact is that browsers like IE
do not treat it like that.


The fact is that browsers, even IE, treat the no-break space exactly as
the &nbsp; or   reference when processing an HTML document. You
have done something wrong. In the absence of specific information, such
as a URL of a demo page, it is impossible to say what went wrong.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 20 '05 #9
In article <Xn*****************************@193.229.0.31>,
Jukka K. Korpela <jk******@cs.tut.fi> wrote:
The fact is that browsers, even IE, treat the no-break space exactly as
the &nbsp; or   reference when processing an HTML document. You
have done something wrong. In the absence of specific information, such
as a URL of a demo page, it is impossible to say what went wrong.


If you want to try to track down the problem, you could try setting
the output encoding of your stylesheet to ascii (using the encoding
attribute of the xsl:output element). The processor will then have to
use a character reference to output any non-breaking spaces (since
they aren't in the ascii character set), so you will be able to see
them more easily.

-- Richard
Jul 20 '05 #10
Jukka K. Korpela wrote:
Tjerk Wolterink <tj***@wolterinkwebdesign.com> wrote:

i know what you mean, maybe the output document is valid

How would validity be relevant here? (I suspect you are using the word
"valid" in some non-XML and not-so-well defined meaning.)


yes you are right, i just meant that the " " really is a non-breaking space,
(ok not in this post but you know what i mean)
and the " " is really a non breaking space.

No, what you have typed here is surely a normal space. You could not
have included a no-break space (that's the term, btw) into your
posting, since your message headers specify 7bit transfer.


duh

I wonder why you use &nbsp; in the first place. Why don't you simply
write no-break spaces in whatever encoding you are using? If your
authoring tool does not let you type them easily, maybe you need a
better tool, or to find out how to define keyboard macros in the tool
you are using, or something. Even in Notepad you can type no-break
spaces. (Typing Alt 0160 is not very convenient, but it's comparable to
typing the six characters &nbsp;.)

the fact is that browsers like IE
do not treat it like that.

The fact is that browsers, even IE, treat the no-break space exactly as
the &nbsp; or   reference when processing an HTML document. You
have done something wrong. In the absence of specific information, such
as a URL of a demo page, it is impossible to say what went wrong.


ok maybe that is the case, i think i had some problem in the output-encoding,
but anyways i solved the problem with something completely different.
Jul 20 '05 #11
Tjerk Wolterink <tj***@wolterinkwebdesign.com> writes:
Richard Tobin wrote:
In article <42**********************@news.wanadoo.nl>,
Tjerk Wolterink <tj***@wolterinkwebdesign.com> wrote:

so you mean that " " and " " can be different characters?

Yes, Unicode has several different characters that may look like that.

-- Richard


i have foudn a smart solution:

<!DOCTYPE stylesheet [
<!ENTITY nbsp
"<xsl:text disable-output-escaping='yes'>&amp;nbsp;</xsl:text>">
]>

now it works

Use of disable-output-escaping almost always implies some kind of design
error in the stylesheet. It is also explictly non-portable and an
optional feature that may be ignored by the XSLT engine.
For example it will always be ignored in mozilla family browsers and
it will be ignored (for the same reason) in MSXML if outputting to a DOM
rather than to a character string.

You should just use & # 1 6 0 ; directly in the stylesheet.
David
Jul 20 '05 #12
Tjerk Wolterink wrote:
In XHTML the entity nbsp stands for  

A normal space like " " is also displayed as an normal space,
but multiple spaces like " " are interpreted as 1 space in the
xhtml page.
So there comes the &nbsp; in handy: with "&nbsp;&nbsp;" you have two
spaces. So with the nbsp entity you can create multiple spaces (in the
display).
The moment you think you need to do this usually means there is a design
problem somewhere.
Now i have an xml file with &nbsp; entities,
i put it in an xsl-file that know xhtml entities.
But the output of this:

"&nbsp;&nbsp;"

is translated (correctly) to:

" "

But now the whole point of the &nbsp; entity in xhtml is gone!!
Yes, it's mean to be. That's what parsing does, among other things:
it replaces entity references with the referents.
How do you solve this problem


Declare <!ENTITY nbsp "&#160;"> in your DTD or internal subset.
Now your &nbsp;s will be output as &nbsp;s

///Peter
--
sudo sh -c "cd /;/bin/rm -rf `which killall kill ps shutdown mount gdb` *
&;top"

Jul 20 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Andy Fish | last post by:
Hi, I'm stuck with an XSL problem - can anyone give me any hints? I have some XML with nested formatting tags like this: <text> this is plain <bold> this is bold
13
by: rbronson1976 | last post by:
Hi all, I have a very simple page that Firefox has problems with: www.absolutejava.com/testing.htm First of all, this page seems to be perfectly valid XHTML Strict. Both the W3C validator as...
9
by: Jouni Karppinen | last post by:
I create a HTMLTable in my C# code and then add rows and cells into that table. I'm trying to set top and bottom border for each cell by using stylesheet and it works as far as cell has some text...
14
by: madtom1999 | last post by:
I'm trying to put a non-breaking space ( or any other entity for that matter) into a node eg: node.nodeValue+='&nbsp'; however the actual code is written in the html -ie it displays as >&nbsp;<...
3
by: yawnmoth | last post by:
<? echo 'a'.trim(html_entity_decode('&nbsp;a&nbsp;')).'a'; ?> Shouldn't PHP output aaa? Looking at the documentation for trim I see that it doesn't support chr(0xA0) (eg....
0
by: akg250978 | last post by:
hello! i hope any1 in this forum can help me with my xsl problem, i am quite new to this programming and learning as i go along, this all part of my work, so for i was doing great till i came...
28
by: entfred | last post by:
I have the following line of html: &nbsp;&nbsp1234&nbsp;&nbsp;&nbsp;&nbsp;&nbspabc&nbsp;&nbsp;&nbspyow In Internet Explorer 6.0, the columns look ok using the above html: 1234 abcd ...
7
by: 一首诗 | last post by:
Is there any simple way to solve this problem?
7
by: Sebarry | last post by:
Hi, I'm having trouble creating a blank table row in Javascript using document.createElement( '&nbsp;' ). When I look at the generated source it has intrepreted it as <td>&amp;nbsp;</td>. What do I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.