Changes between Version 11 and Version 12 of XsltTemplates


Ignore:
Timestamp:
04/02/11 21:07:55 (11 years ago)
Author:
Fran Boon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • XsltTemplates

    v11 v12  
    1 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.
     1[[TOC]]
     2= XSLT =
     3XSLT and XPath are two key technologies used within Sahana Eden to allow easy importing and exporting of information in a wide variety of formats.
     4
     5Support for importing and exporting data is mostly managed via XSLT templates.
    26
    37== Sahana Data Models ==
    4 The underlying data models in {{{models/}}} define the resulting structure that will be within <sahanapy>. More technical detail is [http://trac.sahanapy.org/wiki/S3XRC available here].
     8The underlying data models in {{{models/}}} define the resulting structure that will be within the XML.
    59
    6 == Sahana XSLT Information ==
    7 Sahana XSLT/XPath capability is provided by [http://codespeak.net/lxml/ lxml]. Currently Sahana only supports XSLT/XPath 1.0.
     10== XSLT Library ==
     11Sahana XSLT/XPath capability is provided by [http://codespeak.net/lxml/ lxml]. Currently lxml only supports XSLT/XPath 1.0.
     12
     13A collection of useful reusable functions are stored in {{{static/formats/xml/commons.xsl}}}
    814
    915== Sahana XML Representation ==
    10 Here is a simplified blank XML document that highlights the key elements providing in the native XML within SahanaPy.
    11 {{{
    12 <sahanapy>
    13   <resource name="" uuid="" created_on="" modified_on="" url="">
    14     <data field=""></data>
    15     <reference field="" resource="" uuid=""></reference>
    16   </resource>
    17 </sahanapy>
    18 }}}
    19  * {{{<resource>}}} - identifies the type of resource e.g. {{{name="hms_hospital"}}}
    20  * {{{<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
    21  * {{{<reference>}}} - contains information about things such as location e.g. {{{field="location_id" resource="gis_location"}}}
     16See: [wiki:S3XRC/S3XML]
     17
     18There are 2 parameters which are passed in:
     19 * name (comes from the resourcename - e.g. 'sehlter')
     20 * xsltmode (passed in as a var on the URL - e.g. '&xsltmode=extended')
    2221
    2322== Exporting Data from Sahana ==
    24 Sahana export templates are stored in: {{{static/xslt/export}}}
     23Sahana export templates are stored in: {{{static/formats/*/export.xsl}}}
    2524
    2625== Importing Data from Sahana ==
    27 Sahana import templates are stored in: {{{static/xslt/import}}}
     26Sahana import templates are stored in: {{{static/formats/*/import.xsl}}}
    2827
    2928== Background Info and Resources ==
     
    3332 * [http://www.w3schools.com/xpath/default.asp XPath Tutorial] on w3schools
    3433 * [http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog&xsltfile=cdcatalog interactive xslt environment]
     34
     35== Debugging ==
     36Debug the stylesheets outside Sahana using Xalan.
     37
     38Start by converting smaller extracts in debug mode:
     39{{{
     40java -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
     41}}}
     42
     43Then process the full thing in non-debug mode:
     44{{{
     45java -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
     46}}}
     47
     48For a graphical IDE (Java, so cross-platform), you can trial [http://editix.com EditX]
     49
     50----
     51DeveloperGuidelines