Wrox Programmer Forums
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 27th, 2005, 10:57 AM
Authorized User
 
Join Date: Sep 2005
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSLTC

Hi i want to use a pre-compiler XSLT file, to transform a XML file
I do

TransformerFactory tFactory = TransformerFactory.newInstance();
Templates translet = tFactory.newTemplates(new StreamSource(xslFile));
Transformer transformer = translet.newTransformer();
transformer.transform(xmlSource, new StreamResult(writer));



I am get this error
ERROR: 'Invalid byte 2 of 2-byte UTF-8 sequence.'
Is there any thing i need to change for this to work?
Because my XSLT fie is in iso-8859-1and so is my XML file

Thank you

 
Old September 27th, 2005, 11:36 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Does your XML file say

<?xml version="1.0" encoding="iso-8859-1"?>

at the top? If it doesn't, the XML parser will assume it's in UTF-8 encoding - which apparently it isn't.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old September 27th, 2005, 12:42 PM
Authorized User
 
Join Date: Sep 2005
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The top of my XSLT is like this

<?xml version="1.0" encoding="iso-8859-1"?>
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" encoding="iso-8859-1" doctype-public="-//WAPFORUM//DTD WML 1.3//EN" doctype-system="http://www.wapforum.org/DTD/wml13.dtd"/>

I don't reference UTF-8 anywhere, is there some default value in transformer or something, that i need to change?

thanks

 
Old September 28th, 2005, 03:21 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Whether the problem is your source file or your stylesheet, if it's encoded in iso-8859-1 then it needs to say so in the XML declaration.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
XSLTC compiler error about undefined variables cox1019823 XSLT 1 May 17th, 2006 08:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.