This tool serves as a convertor from Thot/Amaya .T translation language to the XSLT stylesheet. The convertor can be downloaded here. You'll need Java JRE 1.4.0 or higher to run the convertor.
To convert foo.T to foo.xsl, simply run
There are following switches:
Switch | Description |
---|---|
-q |
quiet mode; it does not display any output except the detailed error message when the error occurs. |
-v=0 |
Verbose level 0, equivalent to the -q switch |
-v=1 |
Verbose level 1 (default), prints only warnings and errors |
-v=2 |
Verbose level 2, prints more detailed information, like which file is being parsed etc. |
-v=3 |
Verbose level 3, prints everything. Useful for debugging. It also shows effective values of all switches. |
-ns="namespace" |
The namespace of the XML document that the XSLT script shall process. Defaults to empty namespace. |
-id=name |
The name of the attribute containing unique identifier
of the element. Defaults to id . |
-rid=name |
The name of the attribute that references elements with unique identifier
equal to the value of this attribute. Defaults to rid .
|
--params=file |
Replaces this switch with switches loaded from given file. In this file, each switch must be on a single line. There is no need to escape quotes in the file. If the file is - then the parameters are loaded from the standard input. The file is expected to be in UTF-8 encoding. |
--FileName=code |
XSLT does not receive the location of the file it outputs hence you must specify it yourself.
Specify a XSLT code that replaces (prints) FileName expression - the name of the output file.
This code is used whenever FileName value is required.
All XSLT elements should be prefixed with xsl: .
To read the XSLT parameter providen by EuroMath2 just write:--FileName="<xsl:value-of select=\"empar:resultName\"/>" Note that you must define the empar namespace in the result XSLT script:--xmlns:empar="http://www.uniba.sk/euromath/parameters"
|
--FileDir=code |
XSLT code that replaces (prints) FileDir expression - the directory where the output file is stored.
You may wrap the switch in "" when needed. To read the XSLT parameter provided by EuroMath2 just write: --FileDir="<xsl:value-of select=\"empar:resultDir\"/>"
|
--Extension=code |
XSLT code that replaces (prints) Extension expression - the extension of the output file.
To read the XSLT parameter provided by EuroMath2 just write:--Extension="<xsl:value-of select=\"empar:resultExtension\"/>"
|
--DocumentName=code |
XSLT code that replaces (prints) DocumentName expression - the name of the source document.
To read the XSLT parameter provided by EuroMath2 just write:--DocumentName="<xsl:value-of select=\"empar:documentName\"/>"
|
--DocumentDir=code |
XSLT code that replaces (prints) DocumentDir expression - the directory where the source document is located.
To read the XSLT parameter providen by EuroMath2 just write:--DocumentDir="<xsl:value-of select=\"empar:documentDir\"/>"
|
--xmlns:prefix="namespace" |
Binds prefix to the namespace - places this xmlns definition into the root element (the xsl:stylesheet element). |
--use-em2-params |
Makes use of xslt parameters provided by EuroMath2 and produces code for FileName, FileDir, Extension,
DocumentName and DocumentDir that uses them. Equivalent to:--xmlns:empar="http://www.uniba.sk/euromath/parameters" --FileName="<xsl:value-of select=\"empar:resultName\"/>"
--FileDir="<xsl:value-of select=\"empar:resultDir\"/>" --Extension="<xsl:value-of select=\"empar:resultExtension\"/>"
--DocumentName="<xsl:value-of select=\"empar:documentName\"/>" --DocumentDir="<xsl:value-of select=\"empar:documentDir\"/>"
|
--PresAttrName=value |
Overrides the value of Thot presentation attribute. Normally, all presentation attributes in all elements receives default values. These
values are hardwired in the XSLT stylesheet because it can't access their values - they are known to Thot only. Values of these attributes
can be overriden by specifying other value, or using If the switch is in format You may specify a value, or you may specify XSLT part that prints out the value. Context node (.) is the element that is currently being processed by the rule, or a text node. If the code part does not print anything then it means that the presentation attribute is not defined for this node. |
--euromath-xml |
Instead of hardwired values of presentation attributes, XSLT shall detect them from the XML document using the EuroMath 1 format. These presentation attributes are stored in form of special processing instructions. Click here for table of value substitution rules. It also specifies that only the 'Y' text-translation rule can be used only for element |
--no-pres-attrs |
Overrides the default processing of presentation attributes: if the attribute is not defined using
-PresAttrName=value switch then rule for this attribute is ignored and shall not
appear in the result XSLT.
|
--apply-rules-on-text |
By default, rules for presentation attributes are not applied on text. This settings overrides this behaviour. |
--no-translation |
By default, all text translations (defined by TEXTTRANSLATION rules) are merged together and
applied on all text nodes. When this option is specified then all TEXTTRANSLATION rules are ignored except those
defined explicitly by the --use switch.Note: to convert XHTML entities back to Thot character this translation table is used. |
--use=translation-name,XPath-expression |
Effective only when --no-translation is specified. When specified then the translation translation-name
is applied on a text node if and only if the XPath-expression evaluates to true .Note: to convert XHTML entities back to Thot character this translation table is used. |
--normalize-space=element-local-name |
Everything produced by descendant elements of this element is converted to a text and whitespace-normalized. |
Warning: switch order does matter. For example, when using switches
--FileDir=foo --use-em2-params
the --FileDir
switch introduced in --use-em2-params
overrides the value of previous
--FileDir
switch. To let FileDir value be foo but use other switches defined in --use-em2-params
use
--use-em2-params --FileDir=foo
This transformer is currently being developed. If you encounter a bug please submit it via the bug tracker.
You may register generated stylesheets to EuroMath2 using this manual.
This table summarizes default values of presentation attributes.
Attribute name | Type | Default value |
---|---|---|
Size | Number | 12 |
Indent | Number | Attribute not present/defined |
LineSpacing | Number | Attribute not present/defined |
LineWeight | Number | Attribute not present/defined |
Adjust | Left | Right | VMiddle | LeftWithDots | Left |
Justify | Yes | No | No |
Hyphenate | Yes | No | No |
Style | Roman | Italics | Oblique | Roman |
Weight | Normal | Bold | Normal |
Font | Times | Helvetica | Courier | Times |
UnderLine | NoUnderline | UnderLined | OverLined | CrossedOut | NoUnderline |
Thickness | Thick | Thin | Thin |
LineStyle | Solid | Dashed | Dotted | Solid |
FillPattern | Name | Attribute not present/defined |
Background | Name | Attribute not present/defined |
Foreground | Name | Attribute not present/defined |
This table shows rules effective when working with EM1 document file.
Processing instruction | Presentation attributes values |
---|---|
[Text_article:SB] in <?ThotPresBegin?> or <?ThotGPresBegin?> |
Weight="Bold" |
[Text_article:SI] in <?ThotPresBegin?> or <?ThotGPresBegin?> |
Weight="Normal", Style="Italics" |
[Text_article:SO] in <?ThotPresBegin?> or <?ThotGPresBegin?> |
Weight="Normal", Style="Oblique" |
[Text_article:SG] in <?ThotPresBegin?> or <?ThotGPresBegin?> |
Weight="Bold", Style="Italics" |
[Text_article:SQ] in <?ThotPresBegin?> or <?ThotGPresBegin?> |
Weight="Bold", Style="Oblique" |
[Text_article:SR] in <?ThotPresBegin?> or <?ThotGPresBegin?> |
Weight="Normal", Style="Roman" |
[Text_article:Tnum] in <?ThotPresBegin?> or <?ThotGPresBegin?> |
Size="num" |
[Text_article:UN] in <?ThotPresBegin?> or <?ThotGPresBegin?> |
UnderLine="NoUnderline" |
[Text_article:UO] in <?ThotPresBegin?> or <?ThotGPresBegin?> |
UnderLine="OverLined" |
[Text_article:UU] in <?ThotPresBegin?> or <?ThotGPresBegin?> |
UnderLine="UnderLined" |
[Text_article:UC] in <?ThotPresBegin?> or <?ThotGPresBegin?> |
UnderLine="CrossedOut" |
[Text_article:Fvalue] in <?ThotPresBegin?> or <?ThotGPresBegin?> |
Font="value" |
[Text_article:Inum] in <?ThotGPresBegin?> |
Indent="num" |
[Text_article:AR] in <?ThotGPresBegin?> |
Adjust="Right" |
[Text_article:AL] in <?ThotGPresBegin?> |
Adjust="Left" |
[Text_article:AC] in <?ThotGPresBegin?> |
Adjust="VMiddle" |
[Text_article:AD] in <?ThotGPresBegin?> |
Adjust="LeftWithDots" |
[Text_article:JY] in <?ThotGPresBegin?> |
Justify="Yes" |
[Text_article:JN] in <?ThotGPresBegin?> |
Justify="No" |
[Text_article:Lnum] in <?ThotGPresBegin?> |
LineSpacing="num" |
The --euromath-xml
switch makes these rules effective using these switches:
Switch | Value |
---|---|
--Size | <xsl:for-each select="preceding-sibling::processing-instruction()[last()][name()='ThotPresBegin' or name()='ThotGPresBegin']"><xsl:if
test="substring-after(., '[Text_article:T') != ''"><xsl:value-of
select="substring-before(substring-after(., '[Text_article:T'), ']')"/></xsl:if></xsl:for-each> |
--Weight | <xsl:for-each select="preceding-sibling::processing-instruction()[last()][name()='ThotPresBegin' or name()='ThotGPresBegin']"><xsl:if
test="substring-after(., '[Text_article:S') != ''"><xsl:variable
name="__weight_pi_val" select="substring-before(substring-after(., '[Text_article:S'), ']')"/><xsl:if
test="substring-before('^BGQ', $__weight_pi_val) !=
''"><xsl:text>Bold</xsl:text></xsl:if><xsl:if
test="substring-before('^IOR', $__weight_pi_val) !=
''"><xsl:text>Normal</xsl:text></xsl:if></xsl:if></xsl:for-each> |
--Style | <xsl:for-each select="preceding-sibling::processing-instruction()[last()][name()='ThotPresBegin' or name()='ThotGPresBegin']"><xsl:if
test="substring-after(., '[Text_article:S') != ''"><xsl:variable
name="__style_pi_val" select="substring-before(substring-after(., '[Text_article:S'), ']')"/><xsl:if
test="substring-before('^IG', $__style_pi_val) !=
''"><xsl:text>Italics</xsl:text></xsl:if><xsl:if
test="substring-before('^OQ', $__style_pi_val) !=
''"><xsl:text>Oblique</xsl:text></xsl:if><xsl:if
test="$__style_pi_val = 'R'"><xsl:text>Roman</xsl:text></xsl:if></xsl:if></xsl:for-each> |
--UnderLine | <xsl:for-each select="preceding-sibling::processing-instruction()[last()][name()='ThotPresBegin' or name()='ThotGPresBegin']"><xsl:if
test="substring-after(., '[Text_article:U') != ''"><xsl:variable
name="__underline_pi_val" select="substring-before(substring-after(., '[Text_article:U'), ']')"/><xsl:if
test="$__underline_pi_val = 'N'"><xsl:text>NoUnderline</xsl:text></xsl:if><xsl:if
test="$__underline_pi_val = 'O'"><xsl:text>OverLined</xsl:text></xsl:if><xsl:if
test="$__underline_pi_val = 'U'"><xsl:text>UnderLined</xsl:text></xsl:if><xsl:if
test="$__underline_pi_val = 'C'"><xsl:text>CrossedOut</xsl:text></xsl:if></xsl:if></xsl:for-each> |
--Font | <xsl:for-each select="preceding-sibling::processing-instruction()[last()][name()='ThotPresBegin' or name()='ThotGPresBegin']"><xsl:if
test="substring-after(., '[Text_article:F') != ''"><xsl:value-of
select="substring-before(substring-after(., '[Text_article:F'), ']')"/></xsl:if></xsl:for-each> |
--Indent | <xsl:for-each select="preceding-sibling::processing-instruction()[last()][name()='ThotGPresBegin']"><xsl:if
test="substring-after(., '[Text_article:I') != ''"><xsl:value-of
select="substring-before(substring-after(., '[Text_article:I'), ']')"/></xsl:if></xsl:for-each> |
--Adjust | <xsl:for-each select="preceding-sibling::processing-instruction()[last()][name()='ThotGPresBegin']"><xsl:if
test="substring-after(., '[Text_article:A') != ''"><xsl:variable
name="__adjust_pi_val" select="substring-before(substring-after(., '[Text_article:A'), ']')"/><xsl:if
test="$__adjust_pi_val = 'R'"><xsl:text>Right</xsl:text></xsl:if><xsl:if
test="$__adjust_pi_val = 'L'"><xsl:text>Left</xsl:text></xsl:if><xsl:if
test="$__adjust_pi_val = 'C'"><xsl:text>VMiddle</xsl:text></xsl:if><xsl:if
test="$__adjust_pi_val = 'D'"><xsl:text>LeftWithDots</xsl:text></xsl:if></xsl:if></xsl:for-each> |
--Justify | <xsl:for-each select="preceding-sibling::processing-instruction()[last()][name()='ThotGPresBegin']"><xsl:if
test="substring-after(., '[Text_article:J') != ''"><xsl:variable
name="__adjust_pi_val" select="substring-before(substring-after(., '[Text_article:J'), ']')"/><xsl:if
test="$__adjust_pi_val = 'Y'"><xsl:text>Yes</xsl:text></xsl:if><xsl:if
test="$__adjust_pi_val = 'N'"><xsl:text>No</xsl:text></xsl:if></xsl:if></xsl:for-each> |
--LineSpacing | <xsl:for-each select="preceding-sibling::processing-instruction()[last()][name()='ThotGPresBegin']"><xsl:if
test="substring-after(., '[Text_article:L') != ''"><xsl:value-of
select="substring-before(substring-after(., '[Text_article:L'), ']')"/></xsl:if></xsl:for-each> |
--normalize-space=mathemat |