summaryrefslogtreecommitdiff
path: root/docs/tutorials/lxmlgraph/step04/myapp/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'docs/tutorials/lxmlgraph/step04/myapp/views.py')
-rw-r--r--docs/tutorials/lxmlgraph/step04/myapp/views.py13
1 files changed, 13 insertions, 0 deletions
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>
+ site = context.getroottree().getroot()
+ # Jot down which node we're sitting on as the <context>
+ contextid = "'%s'" % context.get(XML_PREFIX+'id')
+ return render_transform_to_response("xsltview.xsl", site,
+ contextid=contextid)