Skip to content

Commit

Permalink
#9 more doc
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Aug 4, 2021
1 parent cdb7e40 commit f1b0442
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/resources/org/polystat/far/build-calc-function.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" id="build-calc-function" version="2.0">
<!--
This XSL is used in the Calc.java class in order to turn "rules.txt"
into a new XSL document. Yes, this XSL produces another XSL. Run
CalcTest.java to see the example of it.
-->
<xsl:strip-space elements="*"/>
<xsl:template match="inputs">
<xsl:variable name="inputs" select="."/>
Expand Down
38 changes: 38 additions & 0 deletions src/main/resources/org/polystat/far/calculate.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,44 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ps="https://www.polystat.org" xmlns:xs="http://www.w3.org/2001/XMLSchema" id="calculate" version="2.0">
<!--
This XSL relies on a pre-built XSL stylesheet known as "calc-function.xsl",
which is not a file, but a generated in runtime document. It is generated
by the Calc.java, with the help of "build-calc-function.xsl" stylesheet.
This XSL is supposed to be called multiple times on the same document,
until all <r> elements disappear.
Here, we take an <r> element and turn it into a few <opt> elements.
For example, this XML document:
<o name="foo">
<o line="3" name="a">
<opts>
<r f=".div" pos="2" tau="8">
<r f=".div" pos="1" tau="7">
<r f=".add" pos="2" tau="3"/>
</r>
</r>
</opts>
</o>
</o>
Will turn into:
<o name="foo">
<o line="3" name="a">
<opts>
<r f=".div" pos="2" tau="8">
<r f=".div" pos="1" tau="7">
<opt m=".add(\perp)[2]" x="\perp">{𝜏3:2=1}</opt>
<opt m=".add(\perp)[2]" x="\any">{𝜏3:2=2}</opt>
</r>
</r>
</opts>
</o>
</o>
-->
<xsl:strip-space elements="*"/>
<xsl:import href="calc-function.xsl"/>
<xsl:function name="ps:tau">
Expand Down

0 comments on commit f1b0442

Please sign in to comment.