Skip to Content
XSLT
book

XSLT

by Doug Tidwell
August 2001
Intermediate to advanced
480 pages
11h 16m
English
O'Reilly Media, Inc.
Content preview from XSLT

How Do I Control Angle Brackets and Quote Marks in My Output?

The XML 1.0 Specification defines five entities you can use to generate special characters: the apostrophe, or single quote mark (defined as '); the ampersand (defined as &); the less-than sign, or left angle bracket (defined as <); the double-quote mark (defined as "); and the greater-than sign, or right angle bracket (defined as >). You can use these entities to output one of these special symbols without an eager XML parser attempting to process them as metacharacters along the way.

If using the predefined entities doesn’t do the trick, use the disable-output-escaping attribute of the <xsl:text> element. If you set this attribute to yes, the XSLT processor will not convert entities such as &lt; and &gt; to their associated characters.

Here’s an <xsl:text> element with the normal setting and the results it generates:

<xsl:text>Hey, y&apos;all!</xsl:text>

Output:

Hey, y'all!

Here’s the same listing with output escaping disabled:

<xsl:text disable-output-escaping="yes">Hey, y&apos;all!</xsl:text>

Output:

Hey, y&apos;all!

Be aware that the disable-output-escaping attribute may not be supported by all XSLT processors, and it may result in XML that is not well formed. For these reasons, the XSLT specification advises that disable-output-escaping “should be used only when there is no alternative.”

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Learning XSLT

Learning XSLT

Michael Fitzgerald
Inside XSLT

Inside XSLT

Steven Holzner
XSLT for Dummies

XSLT for Dummies

Richard Wagner
XSLT Cookbook

XSLT Cookbook

Sal Mangano

Publisher Resources

ISBN: 0596000537Catalog PageErrata