Skip to content

Instantly share code, notes, and snippets.

@klette
Created June 8, 2009 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klette/126113 to your computer and use it in GitHub Desktop.
Save klette/126113 to your computer and use it in GitHub Desktop.
#! /usr/bin/perl
use XML::Template;
my $doc = XML::Template::process_file('../xml/form.xml', {
'title' => 'Form test',
'#myform/action' => 'foobar'
});
print $doc->toString;
#! /usr/bin/python
import xmltemplate
doc = xmltemplate.process_file("../xml/form.xml", {
'title': 'Form test',
'#myform/action': 'foobar'
})
print doc.toxml()
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE
html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:t="http://template.sesse.net/" xml:lang="en">
<head>
<title />
</head>
<body>
<form t:id="myform" action="" method="post">
<input type="submit" />
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Form test</title>
</head>
<body>
<form action="foobar" method="post">
<input type="submit" />
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment