|Version 19 (modified by 10 years ago) ( diff ),|
Table of Contents
XSLT and XPath are two key technologies used within Sahana Eden 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, which can even be done on-the-fly.
Sahana Data Models
The underlying data models in
models/ define the resulting structure that will be within the XML.
Sahana XML Representation
There are 2 parameters which are passed in:
- name (comes from the resourcename - e.g. 'shelter')
- xsltmode (passed in as a var on the URL - e.g. '&xsltmode=extended')
A collection of useful reusable functions are stored in
Exporting Data from Sahana
Sahana export templates are stored in:
Importing Data from Sahana
Sahana import templates are stored in:
Background Info and Resources
Sahana XSLT/XPath capability is provided by lxml. Currently lxml only supports XSLT/XPath 1.0.
- XSLT Tutorial on w3schools
- XPath Tutorial on w3schools
- XSLT starter resources by Dave Pawson
- XSLT FAQ by Dave Pawson
- XSLT V2 reference on W3C
- XPath V2 reference on W3C
- interactive xslt environment
Basic stylesheet checking can be done outside Sahana using the same functions as-used internally:
Full debugging can be done using Xalan. Start by converting smaller extracts in debug mode:
java -jar xalan.jar -param name shelter -param xsltmode extended -tt -tg -ts -in japanquake2011_shelter_extract.kml -xsl web2py\applications\eden\static\formats\kml\import.xsl -out shelters.xml
Then process the full thing in non-debug mode:
java -jar xalan.jar -param name shelter -param xsltmode extended -in japanquake2011_shelter.kml -xsl web2py\applications\eden\static\formats\kml\import.xsl -out shelters.xml
For a graphical IDE (Java, so cross-platform), you can trial EditX