• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

nbsp in .xsl?

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Again...
What do I do if I want to have the ' ' in my .xsl file? When I run the SimpleTransform example and have the " " in my .xsl file I get an error: javax.xml.transform.TransformerConfigurationException: The entity 'nbsp' was referenced, but not declared.
How do I write so it doesn't think it's an entity?
Problem 2: I want to have the 'nowrap' in my HTML tag <td> but the transformer can't handle it.
/Nils
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you need to escape the '&' using '&amp;' (ie, for each non-breaking space you want in the output, use '&amp;nbsp;')
[This message has been edited by Frank Carver (edited June 08, 2001).]
 
Frank Carver
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As for the nowrap attribute, there should be no problem with generating it. Can you give a little more information about what you are trying, and what actually happens?
 
Nils Persson
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I put the nowrap in I get this error:
Attribute name "td" must be followed by the '=' character
The code:
<td class="txt" valign="top" align="right" NOWRAP>
When I take the nowrap away it works fine.
If I change the & nbsp to & amp;nbsp; it just writes it to the screen.
/Nils
 
Frank Carver
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, I see the problem with the nowrap. It's not valid XML. Have you tried adding a dummy value for the nowrap attribute: nowrap='' ?
As for the nbsp, what are you using to process your XSL, and how are you sending the result to the browser? I've generated entity sequences like this before with no trouble, so I guess you are doing something a bit different from my experience.
 
Nils Persson
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.
Ok, I try nowrap= thing...
I use the SimpleTransform example from IBM LotusXSL. That takes two files .xsl and .xml and a third output file .html.
From my site I just include the .html file.
Do I have to have a .dtd file to declare the nbsp?
/Nils
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
XSL stylesheet is an XML document itself, so it is perfectly possible to have DTD in it:
<?xml version='1.0'?>
<!DOCTYPE stylesheet [
<!ENTITY nbsp "�" >
]>
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
...

Then you can simply type &nbsp; in your XSLT. I used the construction above and it works fine
[This message has been edited by Mapraputa Is (edited June 08, 2001).]
 
Mapraputa Is
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Interesting. NOWRAP thing is rather mysterious. Seems to be the only HTML attribute breaking well-formedness. But it is how TD tag is defined:
<TD LANG="..." DIR=ltr|rtl ID="..." CLASS="..." AXIS="..." AXES="..." NOWRAP ROWSPAN=value COLSPAN=value ALIGN=left|right|center|justify|char|decimal CHAR="..." CHAROFF="..." DP="..." VALIGN=top|middle|bottom|baseline WIDTH=value BGCOLOR="...">characters...</TD>
I wonder what was the reason to make NOWRAP a syntactic exception?
Also <P> tag is defined as
<P ... WRAP=on|off NOWRAP ...>

I hope Frank�s variant will work. If not, you will need to bury yourself into <xsl:text> mess
If you need simply output TD tag with NOWRAP word, regardless of XML data, you can go like this:
<xsl:text disable-output-escaping="yes">
&lt;td class="txt" valign="top" align="right" NOWRAP>
</xsl:text>

If you need to output some part of the TD tag based on XML data, say, you need to read the value for your class attribute, then it is a bit more complicated.
Assuming the value is in <properElement properAttribute=�...�>, we break the target expression into three parts:

1. <xsl:text disable-output-escaping="yes">
&lt;td class="</xsl:text>
2. <xsl:value-of select="properElement/@properAttribute"/>
3. <xsl:text disable-output-escaping="yes">" valign="top" align="right" NOWRAP>
</xsl:text>


[This message has been edited by Mapraputa Is (edited June 08, 2001).]
 
Mapraputa Is
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes! Frank�s advice will work in XHTML variant:
"The HTML to XHTML Headache -- What Needs to Change:
XML does not allow attribute minimization.
Stand-alone attributes must be expanded (eg. <td nowrap>cell</td> becomes <td nowrap="nowrap">cell</td> )
(URL: http://www.zdnet.com/devhead/resources/tag_library/history/xhtml.html)
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry, but have u tried   for space.
and nowrap="true" ?
 
tom_2000
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i guess the ' ' from the last post worked, it didnt' show!
(leave out the single quotes in yr code)
 
tom_2000
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok, so sorry, last try:
i typed it &.#.160.;
leave out the period in your code.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear...,
I don't know whether u still have the problem with the space. Still I have something that works.( I have seen it work. )
<xsl:text disable-output-escaping="yes">& amp;nbsp;</xsl:text> whereever you wish to use �.
Using an entity that puts in ' ' in a document is as good as putting a space. I guess so! please correct me if I am wrong.
AJD.
------------------
-AJD.
[This message has been edited by Aldrin Dsouza (edited July 09, 2001).]
[This message has been edited by Aldrin Dsouza (edited July 09, 2001).]
 
It's a beautiful day in this neighborhood - Fred Rogers. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic