my dog learned polymorphism*
The moose likes XML and Related Technologies and the fly likes NBSP in Html output Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "NBSP in Html output" Watch "NBSP in Html output" New topic
Author

NBSP in Html output

Tim Voet
Ranch Hand

Joined: Jan 30, 2002
Posts: 30
Hi everyone. Its been a while since i have been on the forum, its good to be back.
here is my question. I am getting into XSL, and XSLT transformations...
i am having a problem when i put my XML through my transformer. when it generates my Html output, i would like to put a non-breaking space intead of a null value. The null value is very ugly to look at when you open the Html in a browser.
does anyone have a suggestion or a trick that i am missing.
thanks
Tim


---<br />Nothing is impossible, only improbable !!!
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
Similar question was asked here: http://www.coderanch.com/t/125062/XML/add-nbsp-XSL-rule
HTH
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by Mapraputa Is:
HTH

HTH means ?


Spritle Software Blogs
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
HTH = Hope This Helps
Tim Voet
Ranch Hand

Joined: Jan 30, 2002
Posts: 30
that isn't quite want i want to know. I had found that post when i did a search. what i want is more something like this

and what i want to do is when one of the value-of return values returns null, i want to put a B]& nbsp ;[/B] in the html.
for this reason i don't think that the entity reference will help. My output is generated completely, but to anyone who has ever worked with HTML, will know that if you don't put a blank space in a empty table cell, the border does not show around that cell, and screws up the look of the page.
thanks anyways for the direction you pointed me in.
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
You can use xsl:if or xsl:choose,xsl:when for testing conditions.
for example

this will avoid borderless table or something.
[ July 10, 2002: Message edited by: Mapraputa Is ]
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Hi Map & Micheal,
There is some error is UBB code on using [ code ] tag..
I think this is not solved in JLive forum also
Tim Voet
Ranch Hand

Joined: Jan 30, 2002
Posts: 30
thanks for the input.
does this mean i should code a function for normalize-space?? or is this an already supported feature.
I really appreciate the help.
Tim
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Its already supported feature,just try to use it in ur code.
Tim Voet
Ranch Hand

Joined: Jan 30, 2002
Posts: 30
thanks.
will try it tonight when i get home.
Tim
Tim Voet
Ranch Hand

Joined: Jan 30, 2002
Posts: 30
thanks Balaji.
it works....i had forgot that i had put my code on my FTP Server.
thanks for your help everyone.
Tim
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
Balaji, what do you mean "There is some error is UBB code on using [ code ] tag.." - smiles on XSL tags? I turned off smiles in your post.
Tim, if yu do not mind extra blank after your data, you probably can just put &nbsp after <xsl:value-of="..."/>
[ July 10, 2002: Message edited by: Mapraputa Is ]
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Hi,
Sorry,I'm so stupid,forgot to turn off the smiles.Thanks.
Originally posted by Mapraputa Is:
smiles on XSL tags? I turned off smiles in your post.
[ July 10, 2002: Message edited by: Mapraputa Is ]
Tim Voet
Ranch Hand

Joined: Jan 30, 2002
Posts: 30
thanks for your help both of you.....i tried putting the space after everything, and it looked ok, but i wanted to try the other method to see, and it worked well.
thanks again...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: NBSP in Html output
 
Similar Threads
Condition check in using rendered
any html file displays "null"
Hidden variables coming as null
getting the response stream from jsp include
Can't perform logic on my bean class getter methods