Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
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 April 24th, 2006, 09:51 AM
Registered User
Join Date: Apr 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Preventing entities in result-tree

Hey everybody

I want to prevent my stylesheets from generating entities for foreign (i.e. non-ascii) characters in the serialized result-tree. I'm using the HTML output method of XSL 1.0/1.1, and it always converts my special characters (such as German umlauts & Cyrillic characters) to entities.
All the XML-files use UTF-8 as encoding, and that's also what I specify in the <xsl:output> tag, but still those entities appear.

I know I could prevent this behaviour by using the "disable-output-escaping" attribute, but this would mean changing a lot of files, which would mean a lot of (extra) work.

Using the XML output method is another way of preventing this (I've tested), but then the generated HTML-files are not rendered correctly in some browsers (i.e. Internet Explorer).

At the moment, upgrading to XSL 2.0 is also out-of-the-question, because of time-constraints and I'm not sure that would do me any good.

Is there another way of forcing XSL not to generate entities? I've been searching the Web for the past week, and all I can find are question of people who actually want to have those entities in their result [:-(]

Thanks in advance

Old April 24th, 2006, 10:03 AM
mhkay's Avatar
Wrox Author
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts

Technically they aren't entities, they are either entity references or character references. For example, & nbsp; is an entity reference, while & #xa0; is a character reference.

XSLT 1.0 gives the serializer free range on this: it can do what it likes, so long as the serialized form is an accurate representation of what is in the result tree. Your particular product might give you more control (Saxon 6.x does, for example, though an extension attribute in xsl:output called saxon:character-representation).

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Old April 24th, 2006, 03:47 PM
Registered User
Join Date: Apr 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Thank you Mr. Kay!

I knew there had to be a way, and I knew you would have the answer :-) We have always been very satisfied with Saxon, and once again it proved to be the right choice.



Similar Threads
Thread Thread Starter Forum Replies Last Post
for-each on result tree fragment RoeZ XSLT 11 November 22nd, 2007 07:31 AM
GridView and SQL More than one result = one result DarkForce ASP.NET 2.0 Basics 0 July 20th, 2007 04:29 AM
how to exclude elements in the result tree output ntmt XSLT 0 May 25th, 2006 10:33 AM
Transforming a result tree with yet another Xslt ballo XSLT 2 March 7th, 2006 09:42 AM
Entities safin XSLT 1 November 7th, 2005 04:59 AM

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