Version 7 (modified by 15 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>.
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> </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 inmodels/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
- XSLT V2 reference on W3C
- XPath V2 reference on W3C
- XSLT Tutorial on w3schools
- XPath Tutorial on w3schools