Index: t/filter.t
===================================================================
--- t/filter.t	(revision 1180)
+++ t/filter.t	(working copy)
@@ -290,6 +290,13 @@
 &quot;It isn't what I expected&quot;, he replied.
 
 -- test --
+[% FILTER xml %]
+"It isn't what I expected", he replied.
+[% END %]
+-- expect --
+&quot;It isn&apos;t what I expected&quot;, he replied.
+
+-- test --
 [% FILTER format %]
 Hello World!
 [% END %]
Index: lib/Template/Manual/Filters.pod
===================================================================
--- lib/Template/Manual/Filters.pod	(revision 1180)
+++ lib/Template/Manual/Filters.pod	(working copy)
@@ -140,6 +140,11 @@
 For further information on HTML entity encoding, see
 L<http://www.w3.org/TR/REC-html40/sgml/entities.html>.
 
+=head1 xml
+
+Same as the C<html> filter, but adds C<&apos;> which is the fifth XML
+built-in entity.
+
 =head1 html_para
 
 This filter formats a block of text into HTML paragraphs.  A sequence of 
Index: lib/Template/Filters.pm
===================================================================
--- lib/Template/Filters.pm	(revision 1180)
+++ lib/Template/Filters.pm	(working copy)
@@ -46,6 +46,7 @@
     'html_break'      => \&html_para_break,
     'html_para_break' => \&html_para_break,
     'html_line_break' => \&html_line_break,
+    'xml'             => \&xml_filter,
     'uri'             => \&uri_filter,
     'url'             => \&url_filter,
     'upper'           => sub { uc $_[0] },
@@ -325,6 +326,26 @@
 
 
 #------------------------------------------------------------------------
+# xml_filter()                                           [% FILTER xml %]
+#
+# Same as the html filter, but adds the conversion of ' to &apos; which
+# is native to XML.
+#------------------------------------------------------------------------
+
+sub xml_filter {
+    my $text = shift;
+    for ($text) {
+        s/&/&amp;/g;
+        s/</&lt;/g;
+        s/>/&gt;/g;
+        s/"/&quot;/g;
+        s/'/&apos;/g;
+    }
+    return $text;
+}
+
+
+#------------------------------------------------------------------------
 # html_paragraph()                                 [% FILTER html_para %]
 #
 # Wrap each paragraph of text (delimited by two or more newlines) in the
