include yslt_noindent.yml2
// overrides yslt's output function to set CDATA
decl output(method, cdata-section-elements="script");
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns="http://www.w3.org/1999/xhtml"
/* Our namespace to invoke python code */
extension-element-prefixes="ns"
exclude-result-prefixes="ns" {
/* This retrieves geometry obtained through "inkscape -S"
* already parsed by python and presented as a list of
* <bbox x="0" y="0" w="42" h="42">
variable "geometry", "ns:GetSVGGeometry()";
variable "hmitree", "ns:GetHMITree()";
* - copy every attributes
* - copy every sub-elements
/* use real xsl:copy instead copy-of alias from yslt.yml2 */
xsl:copy apply "@* | node()";
variable "mark" > =HMI=\n
/* copy root node and add geometry as comment for a test */
html xmlns="http://www.w3.org/1999/xhtml" {
apply "$geometry", mode="testgeo";
apply "$hmitree", mode="testtree";
/* TODO : paste hmitree hash stored in hmi tree root node */
function evaluate_js_from_descriptions() {
variable "midmark" > \n«$mark»
apply """//*[contains(child::svg:desc, $midmark) or \
starts-with(child::svg:desc, $mark)]""",2
template "*", mode="code_from_descs" {
var path, role, name, priv;
/* if label is used, use it as default name */
|> name = "«@inkscape:label»";
// this breaks indent, but fixing indent could break string literals
value "substring-after(svg:desc, $mark)";
// nobody reads generated code anyhow...
template "bbox", mode="testgeo"{
| ID: «@Id» x: «@x» y: «@y» w: «@w» h: «@h»
template "*", mode="testtree"{
| «$indent» «local-name()» «@name» «@type» «@path»
apply "*", mode="testtree" {
with "indent" value "concat($indent,'>')"