• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 362
  • Last Modified:

Using Ant to Apply XSLT

I am applying an XSLT to an XHTML document using the ant task xslt i.e.

                <xslt basedir="${tempLoc}" destdir="${tempLoc}"
                      style="Stylesheet.xslt">
                </xslt>

The problem I have is that the XHTML document contains some non breaking spaces (&nbsp), and once the stylesheet is applied I get some strange characters displayed on my XHTML page.  I am assuming that these strange characters (Â) are some encoded version of this non breaking space ? as it appears to generate "Â&nbsp;"

How do I get these encoded characters treated correctly ?  I am using Linux Redhat ES 3, with Java 1.5.6_06.

The pages are being served by Apache 2.0.55.

I have tried to replace the &nbsp in the source xhtml to &#160, but this has no effect.
0
NeilSherman
Asked:
NeilSherman
  • 2
  • 2
1 Solution
 
NeilShermanAuthor Commented:
I seem to have found the solution to my own problem!

The solution is to ensure that the attribute encoding="ISO-8859-1" is within the xsl:output element of your stylesheet!
0
 
CEHJCommented:
Set the correct output property:


<outputproperty name="encoding" value="iso8859_1"/>

(See Ant docs for that task)
0
 
NeilShermanAuthor Commented:
lol! Beat you too it, but thanks!
0
 
CEHJCommented:
:-)

That's slightly different in fact, and means you don't need to depend on the encoding being specified in the stylesheet
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now