223 | | == XSLT == |
224 | | * DeveloperGuidelines#XSLT |
| 223 | == XSLT: XML, XSL, XPath == |
| 224 | |
| 225 | We use XSLT (Extensible Stylesheet Language Transformations) to convert external structured data, such as |
| 226 | CSV files, spreadsheets, GIS data, and CAP messages into internal S3XML format, and from there to create Eden database entries, |
| 227 | and also to export Eden data into external data formats. |
| 228 | |
| 229 | XSL Stylesheets are themselves XML documents that specify a conversion between one data format and another. |
| 230 | XPath (XML Path Language) is used to select elements from the source document to act on. |
| 231 | |
| 232 | The stylesheets for various data formats are found in the directory: [https://github.com/flavour/eden/blob/master/static/formats eden/static/formats] |
| 233 | |
| 234 | Support for XSLT is provided by [http://lxml.de/ lxml], which is a Python wrapper for libxml2 and libxslt. |
| 235 | This currently supports the XML 1.0 standard, not 2.0, and there are functions available in 2.0 that are not in 1.0, |
| 236 | so be aware of this when you are consulting XML / XSLT references. |
| 237 | |
| 238 | === Online references === |
| 239 | |
| 240 | * W3 standards |
| 241 | * [http://www.w3.org/standards/xml/transformation XSLT overview] |
| 242 | * [http://msdn.microsoft.com/en-us/library/ms256069%28v=vs.110%29.aspx MSDN XSLT Reference] |
| 243 | * [http://www.dpawson.co.uk/xsl/sect1/sect1.html Dave Pawson's tutorials] |
| 244 | |
| 245 | === Books === |
| 246 | |
| 247 | Mike Kay, XSLT Programmer's Reference, WROX Press |
| 248 | |
| 249 | === Tools === |
| 250 | |
| 251 | Try out your xsl stylesheets with: [https://github.com/flavour/eden/blob/master/static/scripts/tools/xsltransform.py xsltransform.py] |
| 252 | |
| 253 | |