Template::Semantic::Document - Template::Semantic Result object
my $out = Template::Semantic->process('template.html', { 'title, h1' => 'foo', }); my $out = Template::Semantic->process('template.html', { '.foo, .bar' => 'baz', '.mee@class' => 'moo', })->process({ '#boo@src' => 'grr', '#yea .ye' => 'yoo', })->process({ '.foo' => sub { uc }, '.bar' => sub { lc }, }); print $out; print $out->as_string; # same as avobe
Process again to the result and returns Template::Semantic::Document object again. So you can chain
Template::Semantic->process(...)->process(...)
Calls as_string() internally.
as_string()
Returns the result as XHTML/XML.
is_xhtml => [1|0]
Default value is true. Even if DTD is not defined in the template, outputs as XHTML. When sets is_xhtml false, skip this effect.
is_xhtml
my $out = $ts->process(\<<END); <div> <img src="foo" /> <br /> <textarea></textarea> </div> END ; print $out; <div> <img src="foo" /> <br /> <textarea></textarea> </div> print $out->as_string(is_xhtml => 0); <div> <img src="foo"/> <br/> <textarea/> </div>
my $out = Template::Semantic->process($template, ...); my $dom = $out->dom; my $root = $dom->documentElement; # get root element
Gets the result as XML::LibXML::Document.
Template::Semantic
Naoki Tomita <tomita@cpan.org>
To install Template::Semantic, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Template::Semantic
CPAN shell
perl -MCPAN -e shell install Template::Semantic
For more information on module installation, please visit the detailed CPAN module installation guide.