wiki:XsltTemplates

Version 11 (modified by Gavin Treadgold, 12 years ago) ( diff )

--

XSLT and XPath are two key technologies used within SahanaPy to allow easy importing and exporting of information in a wide variety of formats. Support for importing and exporting data is mostly managed via XSLT templates.

Sahana Data Models

The underlying data models in models/ define the resulting structure that will be within <sahanapy>. More technical detail is available here.

Sahana XSLT Information

Sahana XSLT/XPath capability is provided by lxml. Currently Sahana only supports XSLT/XPath 1.0.

Sahana XML Representation

Here is a simplified blank XML document that highlights the key elements providing in the native XML within SahanaPy.

<sahanapy>
  <resource name="" uuid="" created_on="" modified_on="" url="">
    <data field=""></data>
    <reference field="" resource="" uuid=""></reference>
  </resource>
</sahanapy>
  • <resource> - identifies the type of resource e.g. name="hms_hospital"
  • <data> - represents a data field from the model e.g. if a resource is hms_hospital, then the data fields provided will be defined in models/hms.py - look for the resource definition for hospital
  • <reference> - contains information about things such as location e.g. field="location_id" resource="gis_location"

Exporting Data from Sahana

Sahana export templates are stored in: static/xslt/export

Importing Data from Sahana

Sahana import templates are stored in: static/xslt/import

Background Info and Resources

Note: See TracWiki for help on using the wiki.