• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 368
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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