Xml-escaping for htc
use HTML::Template::Compiled::Plugin::XMLEscape; my $htc = HTML::Template::Compiled->new( plugin => [qw(HTML::Template::Compiled::Plugin::XMLEscape)], ... );
gets called by \s-1HTC\s0
escapes data for \s-1XML\s0 \s-1CDATA\s0.
escapes data for \s-1XML\s0 attributes
use HTML::Template::Compiled::Plugin::XMLEscape; my $htc = HTML::Template::Compiled->new( plugin => [qw(HTML::Template::Compiled::Plugin::XMLEscape)], tagstyle => [qw(-classic -comment -asp +tt)], scalarref => \'<foo attr="[%= attribute %]">[%= cdata escape=XML %]</foo>', default_escape => 'XML_ATTR', ); $htc->param( attr => 'foo & bar', cdata => 'text < with > tags', ); print $htc->output;
Output:
<foo attr="foo & bar">text < with > tags</foo>