Josh Canfield wrote:
If your output is being generated as you describe then there is a bug in your
xsl processing stack (xml reader, processor, serializer). The more plausible
cause is that your xsl code is mucking with the character. Without some sample
xsl code that demonstrates the problem it's impossible to figure out what's
wrong.
Try http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=xsl+nbsp
This problem has been thoroughly discussed in this list as well as others, a
google search turned up a large number of applicable hits.
Josh
-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com]On Behalf Of
scott
gabelhart
Sent: Tuesday, January 27, 2004 10:07 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Empty object
Michael Kay wrote:
my mistake SAX has nothing to do with my problem...rather Xalan.
My input xml file contains empty elements that I need to carry the
corresponding attribute values for each of these empty elements.
I'm sorry, I don't understand your English, could you explain it in XML?
As I asked before, what does your input look like, and what do you want
your output to look like?
Of course when my transform complete I am stuck with XHTML
that contains
my favorite NONbreaking Space character.
I don't understand the "Of course", I don't know why your output has
NBSP characters, and I don't know why you want to get rid of them.
Need to have my XHTML output to contain
<td style="bla" ..etc> {space currently is occupied by the
NONbreaking
Space character}. Need to replace when the actual element is
empty the
{NONbreaking Space character with a valid space holding character}
Is the input element empty, or does it contain a non-breaking space
character? I am completely confused.
Attempting to include the string <xsl:text
disable-output-escaping="yes">&amp;nbsp;</xsl:text> without much
luck at the moment.
You said before that you didn't want NBSP characters, so why are you
writing code that's designed to generate them?
What is a best practice method for first determining if a element is
empty; then replace that NONbreaking Space character with a character
that will parse properly with Xalan?
If the element is empty then by definition it doesn't contain a
non-breaking space character.
Non-breaking space characters are perfectly legal in XML and will not
cause Xalan any problems.
Michael Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Michael,
input xml file contains elements that are not empty but contain
<OBJECT> </OBJECT> This nonbreaking space character is needed to
keep the space in this element.
When I run my transform the XHTML output contains <OBJECT>nbsp;</OBJECT>
which of course is wrong. I need the final XHTML output to contain
<OBJECT> </OBJECT>.
What do I need to add to my transform to assure that when my OBJECT
element contains a nonbreaking space character ; my transformed XHTML
output contains <OBJECT> </OBJECT>.
- Scott
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Josh thanks for the timely response. Below is my xsl
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--xsl:output method="xml" version="1.0" encoding="UTF-8"
indent="yes"/-->
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>YOU ROCK</title>
</head>
<body>
<xsl:apply-templates select="//FORMATTED/TABLE"/>
</body>
</html>
</xsl:template>
<xsl:template match="TABLE">
<table>
<xsl:for-each select="@*">
<xsl:choose>
<xsl:when test="name() = 'BORDER'">
<xsl:attribute name="border"><xsl:value-of
select="."/></xsl:attribute>
</xsl:when>
<xsl:when test="name() = 'CELLSPACING'">
<xsl:attribute name="cellspacing"><xsl:value-of
select="."/></xsl:attribute>
</xsl:when>
<xsl:when test="name() = 'CELLPADDING'">
<xsl:attribute name="cellpadding"><xsl:value-of
select="."/></xsl:attribute>
</xsl:when>
<xsl:when test="name() = 'WIDTH'">
<xsl:attribute name="width"><xsl:value-of
select="."/></xsl:attribute>
</xsl:when>
<xsl:when test="name() = 'STYLE'">
<xsl:attribute name="style"><xsl:value-of
select="."/></xsl:attribute>
</xsl:when>
</xsl:choose>
</xsl:for-each>
<xsl:apply-templates/>
</table>
</xsl:template>
<xsl:template match="DPROW">
<tr>
<xsl:apply-templates/>
</tr>
</xsl:template>
<xsl:template match="OBJECT">
<!--xsl:preserve-space elements="*"/-->
<td>
<xsl:for-each select="@*">
<xsl:choose>
<xsl:when test="name() = 'ALIGN'">
<xsl:attribute name="align"><xsl:value-of
select="."/></xsl:attribute>
</xsl:when>
<xsl:when test="name() = 'STYLE'">
<xsl:attribute name="style"><xsl:value-of
select="."/></xsl:attribute>
</xsl:when>
<xsl:when test="name() = 'WIDTH'">
<xsl:attribute name="width"><xsl:value-of
select="."/></xsl:attribute>
</xsl:when>
<xsl:when test="name() = 'HEIGHT'">
<xsl:attribute name="height"><xsl:value-of
select="."/></xsl:attribute>
</xsl:when>
<xsl:when test="name() = 'NAME'">
<xsl:attribute name="name"><xsl:value-of
select="."/></xsl:attribute>
</xsl:when>
<xsl:when test="name() = 'TYPE'">
<xsl:attribute name="type"><xsl:value-of
select="."/></xsl:attribute>
</xsl:when>
<xsl:when test="name() = 'VALIGN'">
<xsl:attribute name="valign"><xsl:value-of
select="."/></xsl:attribute>
</xsl:when>
<xsl:when test="name() = 'COLSPAN'">
<xsl:attribute name="colspan"><xsl:value-of
select="."/></xsl:attribute>
</xsl:when>
<xsl:when test="name() = 'ROWSPAN'">
<xsl:attribute name="rowspan"><xsl:value-of
select="."/></xsl:attribute>
</xsl:when>
</xsl:choose>
</xsl:for-each>
<xsl:apply-templates />
</td>
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list