From 1a7b14de4bc89ef0fd162ef8e62d01926e42b54e Mon Sep 17 00:00:00 2001 From: Paul Everitt Date: Thu, 24 Jul 2008 17:14:16 +0000 Subject: Add tutorial sections --- docs/tutorials/lxmlgraph/step04/myapp/views.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docs/tutorials/lxmlgraph/step04/myapp/views.py (limited to 'docs/tutorials/lxmlgraph/step04/myapp/views.py') diff --git a/docs/tutorials/lxmlgraph/step04/myapp/views.py b/docs/tutorials/lxmlgraph/step04/myapp/views.py new file mode 100644 index 000000000..fd8650e14 --- /dev/null +++ b/docs/tutorials/lxmlgraph/step04/myapp/views.py @@ -0,0 +1,13 @@ +from repoze.bfg.template import render_transform_to_response + +# Some constants +XML_NAMESPACE='http://www.w3.org/XML/1998/namespace' +XML_PREFIX= '{%s}' % XML_NAMESPACE + +def xslt_view(context, request): + # Grab the root of the tree, which should be a + site = context.getroottree().getroot() + # Jot down which node we're sitting on as the + contextid = "'%s'" % context.get(XML_PREFIX+'id') + return render_transform_to_response("xsltview.xsl", site, + contextid=contextid) -- cgit v1.2.3