If i try to use <xsl:text> </xsl:text>
to add a white space in my xslt code a question mark is displayed after it converted to html. Please help to solve this issue.
Thanks Pradeep
If i try to use <xsl:text> </xsl:text>
to add a white space in my xslt code a question mark is displayed after it converted to html. Please help to solve this issue.
Thanks Pradeep
Probably you shoud explicitly specify the encoding like in the following code:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="td[not(node())]">
<xsl:copy>
<xsl:text> </xsl:text>
</xsl:copy>
</xsl:template>
<xsl:template match="/">
<html>
<head>
</head>
<xsl:apply-templates/>
</html>
</xsl:template>
</xsl:stylesheet>
When this transformation is applied against this XML document:
<table border="1">
<tr>
<td>X</td>
<td></td>
<td>X</td>
</tr>
</table>
the wanted result is produced and the browser (IE8) displays the hard space correctly:
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<table border="1">
<tr>
<td>X</td>
<td> </td>
<td>X</td>
</tr>
</table>
</html>