2022-05-02 11:59:43 -04:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2016-08-24 09:43:05 -04:00
|
|
|
<!--
|
2016-08-24 10:19:11 -04:00
|
|
|
Entry point for compilation
|
|
|
|
|
2023-01-17 23:09:25 -05:00
|
|
|
Copyright (C) 2014-2023 Ryan Specialty, LLC.
|
2016-08-24 10:19:11 -04:00
|
|
|
|
|
|
|
This file is part of TAME.
|
|
|
|
|
|
|
|
TAME is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see
|
|
|
|
<http://www.gnu.org/licenses/>.
|
2016-08-24 09:43:05 -04:00
|
|
|
for each task that requires such output.
|
|
|
|
|
|
|
|
Also performs validation.
|
|
|
|
-->
|
2019-02-07 14:36:17 -05:00
|
|
|
<stylesheet version="2.0"
|
|
|
|
xmlns="http://www.w3.org/1999/XSL/Transform"
|
|
|
|
xmlns:lv="http://www.lovullo.com/rater"
|
|
|
|
xmlns:lvm="http://www.lovullo.com/rater/map"
|
|
|
|
xmlns:lvmc="http://www.lovullo.com/rater/map/compiler"
|
|
|
|
xmlns:c="http://www.lovullo.com/calc"
|
|
|
|
xmlns:w="http://www.lovullo.com/rater/worksheet"
|
|
|
|
xmlns:util="http://www.lovullo.com/util"
|
|
|
|
xmlns:preproc="http://www.lovullo.com/rater/preproc"
|
|
|
|
xmlns:compiler="http://www.lovullo.com/rater/compiler"
|
|
|
|
xmlns:calc-compiler="http://www.lovullo.com/calc/compiler"
|
|
|
|
xmlns:ext="http://www.lovullo.com/ext">
|
|
|
|
|
|
|
|
<output
|
2016-08-24 09:43:05 -04:00
|
|
|
indent="yes"
|
|
|
|
omit-xml-declaration="yes"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<!-- processing utilities -->
|
2019-02-07 14:36:17 -05:00
|
|
|
<include href="include/util.xsl" />
|
2016-08-24 09:43:05 -04:00
|
|
|
|
|
|
|
<!-- compiler -> JS -->
|
2019-02-07 14:36:17 -05:00
|
|
|
<include href="include/preprocess.xsl" />
|
|
|
|
<include href="compiler/validate.xsl" />
|
|
|
|
<include href="compiler/js.xsl" />
|
|
|
|
<include href="compiler/map.xsl" />
|
2016-08-24 09:43:05 -04:00
|
|
|
|
2017-05-01 15:14:19 -04:00
|
|
|
<!-- TODO: move into compiler/ -->
|
2019-02-07 14:36:17 -05:00
|
|
|
<include href="c1map.xsl" />
|
2017-05-01 15:14:19 -04:00
|
|
|
|
2016-08-24 09:43:05 -04:00
|
|
|
<!-- contains get-symbol-map -->
|
2019-02-07 14:36:17 -05:00
|
|
|
<include href="include/display.xsl" />
|
2016-08-24 09:43:05 -04:00
|
|
|
|
|
|
|
<!-- allows disabling of time-consuming validation -->
|
2019-02-07 14:36:17 -05:00
|
|
|
<param name="preproc-cache-validate" select="'true'" />
|
2016-08-24 09:43:05 -04:00
|
|
|
|
|
|
|
|
|
|
|
<!--
|
|
|
|
Simply copy the preprocessor output; the caller is responsible for outputting
|
|
|
|
this to a document.
|
|
|
|
-->
|
2019-02-07 14:36:17 -05:00
|
|
|
<template match="/lv:rater|/lv:package" priority="5">
|
2016-08-24 09:43:05 -04:00
|
|
|
<!-- XXX: Duplicate code; see summary -->
|
2019-02-07 14:36:17 -05:00
|
|
|
<variable name="processed">
|
|
|
|
<apply-templates select="." mode="preproc:compile" />
|
|
|
|
</variable>
|
2016-08-24 09:43:05 -04:00
|
|
|
|
|
|
|
<!-- fail on preprocessor errors -->
|
2019-02-07 14:36:17 -05:00
|
|
|
<call-template name="preproc:err-chk">
|
|
|
|
<with-param name="processed" select="$processed" />
|
|
|
|
</call-template>
|
2016-08-24 09:43:05 -04:00
|
|
|
|
|
|
|
<!-- validation must have passed; output the nodes -->
|
2019-02-07 14:36:17 -05:00
|
|
|
<copy-of select="$processed" />
|
|
|
|
</template>
|
2016-08-24 09:43:05 -04:00
|
|
|
|
|
|
|
|
2019-02-07 14:36:17 -05:00
|
|
|
<template name="preproc:err-chk">
|
|
|
|
<param name="processed" />
|
2016-08-24 09:43:05 -04:00
|
|
|
|
2019-02-07 14:36:17 -05:00
|
|
|
<for-each select="$processed//preproc:error">
|
|
|
|
<message terminate="yes">
|
|
|
|
<text>!!! preprocessor error: </text>
|
|
|
|
<value-of select="." />
|
|
|
|
</message>
|
|
|
|
</for-each>
|
|
|
|
</template>
|
2016-08-24 09:43:05 -04:00
|
|
|
|
|
|
|
|
2019-02-07 14:36:17 -05:00
|
|
|
<template match="*" mode="preproc:handle-errors" priority="1">
|
2016-08-24 09:43:05 -04:00
|
|
|
<!-- do nothing -->
|
2019-02-07 14:36:17 -05:00
|
|
|
</template>
|
2016-08-24 09:43:05 -04:00
|
|
|
|
|
|
|
|
2019-02-07 14:36:17 -05:00
|
|
|
<template match="lvm:program-map|lvm:return-map" priority="5">
|
|
|
|
<apply-templates select="." mode="lvmc:compile" />
|
|
|
|
</template>
|
2016-08-24 09:43:05 -04:00
|
|
|
|
|
|
|
|
2019-02-07 14:36:17 -05:00
|
|
|
<template match="w:worksheet" priority="5">
|
|
|
|
<apply-templates select="." mode="w:compile" />
|
|
|
|
</template>
|
2016-08-24 09:43:05 -04:00
|
|
|
|
|
|
|
|
|
|
|
<!-- any unhandled nodes should be an error -->
|
2019-02-07 14:36:17 -05:00
|
|
|
<template match="*" priority="1">
|
|
|
|
<message terminate="yes">
|
|
|
|
<text>fatal: source file is invalid: unexpected node </text>
|
|
|
|
<value-of select="name()" />
|
|
|
|
</message>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</stylesheet>
|