I want to use XSLT as a template language in Django project.
So the plan is:
-
Create some trivial views that just give me some XML. Like this:
xsl = libxslt.parseStyleSheetDoc(libxml2.parseFile(‘stylesheet.xsl’))
…
xsl.applyStylesheet(xml_data)
-
Create the XSLTs that will get the data from the XMLs.
The questions are:
-
How can I use several XMLs? If I use document() function – what URI should I pass there (some kind of http://localhost:8000/my_django_app/my_view.xml)?
-
How can I get ‘private’ data – the things that need authentication (for example, number of messages in user’s mailbox)? As I understand, xsl.applyStylesheet does not know anything about user or one’s rights.
In RESTful design, whatever means used to store and process permanent data is also used to store and process temporary data. Secondly, each state is identified as a resource that has a URL, so we can query and manipulate it at will, syndicate the URL, and associate CRUD actions with HTTP methods.
A related question might be helpful.