<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="filter.rnc" type="application/relax-ng-compact-syntax"?>
<alter-tan-file xmlns="tag:textalign.net,2015:ns">
    <!-- alter instructions to turn an expanded TAN-T(EI) file to docx (Word document) -->
    <phase-list>
        <phase xml:id="label-elements"/>
        <phase xml:id="strip-to-text-only"/>
        <!--<breakpoint/>-->
        <phase xml:id="add-r"/>
        <phase xml:id="add-t"/>
        <phase xml:id="add-formatting"/>
        <phase xml:id="test"/>
    </phase-list>
    <alter phases="label-elements" node-type="element">
        <prepend-content>
            <label>%bold%{name($p1)}</label>
        </prepend-content>
    </alter>
    <alter>
        <where phases="strip-to-text-only" node-type="element processing-instruction comment"/>
        <where phases="strip-to-text-only" node-type="text" node-matches="^\s+$"/>
        <skip/>
    </alter>
    <alter phases="strip-to-text-only" node-type="text" node-matches="\S">
        <wrap element-name="p" namespace-prefix="w" namespace="http://schemas.openxmlformats.org/wordprocessingml/2006/main"/>
    </alter>
    <alter node-type="text" node-matches="\S" phases="add-r">
        <wrap element-name="r"/>
    </alter>
    <alter node-type="text" node-matches="\S" phases="add-t">
        <wrap element-name="t"/>
    </alter>
    <alter node-matches="%bold%" node-type="element" node-name="t" phases="add-formatting">
        <prepend-siblings>
            <w:pPr xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
                <w:rPr>
                    <w:b/>
                    <w:bCs/>
                </w:rPr>
            </w:pPr>
        </prepend-siblings>
    </alter>
    <alter node-type="text" phases="add-formatting">
        <replace pattern="%bold%" replacement=""/>
    </alter>
</alter-tan-file>