Skip to content
Permalink
93de43745e
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
121 lines (105 sloc) 3.58 KB
<?xml version="1.0" encoding="utf-8"?>
<!--
the input is expected to be a "simple syntax" RELAX-NG schema,
as officially documented here: https://relaxng.org/spec.html#simple-syntax
-->
<stylesheet version="2.0"
xmlns="http://www.w3.org/1999/XSL/Transform"
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:rng="http://relaxng.org/ns/structure/1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:eoa="http://www.edition-open-access.de/ns"
xmlns:fcn="fcn"
exclude-result-prefixes="tei fcn xs"
>
<import href="common/utils.xsl"/>
<import href="common/print.xsl"/>
<import href="common/rng_to_rnc.xsl"/>
<import href="rng_to_analysis/simplify_add_shortcuts.xsl"/>
<import href="rng_to_analysis/simplify_flatten.xsl"/>
<import href="rng_to_analysis/rnc_analyse_structure.xsl"/>
<import href="rng_to_analysis/rng_to_dnf.xsl"/>
<!-- parameters: -->
<!-- output intermediate steps into this directory...: -->
<param name="output" as="xs:string" required="yes"/>
<!-- debug printing params: see 'common/print.xsl' -->
<!-- output formats : -->
<output
name="xml_output"
method="xml"
encoding="utf-8"
indent="yes"
/>
<output
name="text_output"
method="text"
encoding="utf-8"
indent="yes"
/>
<strip-space elements="*"/>
<!-- entry point: -->
<template match="/">
<!-- input: -->
<result-document href="{concat($output,'/1_simple.xml')}" format="xml_output">
<copy-of select="."/>
</result-document>
<!-- simplify -->
<variable name="with_shortcuts">
<apply-templates mode="shortcut"/>
</variable>
<if test="$output">
<variable name="im_file" select="concat($output,'/2_with_shortcuts.xml')"/>
<value-of select="eoa:info(concat('writing file: ', $im_file))"/>
<result-document href="{$im_file}" format="xml_output">
<copy-of select="$with_shortcuts"/>
</result-document>
</if>
<!-- flatten -->
<variable name="flattened">
<apply-templates mode="flatten" select="$with_shortcuts"/>
</variable>
<if test="$output">
<variable name="im_file" select="concat($output,'/3_flattened.xml')"/>
<value-of select="eoa:info(concat('writing file: ', $im_file))"/>
<result-document href="{$im_file}" format="xml_output">
<copy-of select="$flattened"/>
</result-document>
</if>
<!-- serialize -->
<!-- (mainly for debugging) -->
<variable name="serialized">
<apply-templates mode="rng_to_rnc" select="$flattened"/>
</variable>
<if test="$output">
<variable name="im_file" select="concat($output,'/3_serialized.txt')"/>
<value-of select="eoa:info(concat('writing file: ', $im_file))"/>
<result-document href="{$im_file}" format="text_output">
<copy-of select="$serialized"/>
</result-document>
</if>
<!-- structured -->
<variable name="structured">
<for-each select="$flattened">
<call-template name="structure"/>
</for-each>
</variable>
<if test="$output">
<variable name="im_file" select="concat($output,'/4_structured.xml')"/>
<value-of select="eoa:info(concat('writing file: ', $im_file))"/>
<result-document href="{$im_file}" format="xml_output">
<copy-of select="$structured"/>
</result-document>
</if>
<!-- structured_advanced -->
<variable name="structured_advanced">
<apply-templates mode="structure_advanced" select="$structured"/>
</variable>
<if test="$output">
<variable name="im_file" select="concat($output,'/5_structured_advanced.xml')"/>
<value-of select="eoa:info(concat('writing file: ', $im_file))"/>
<result-document href="{$im_file}" format="xml_output">
<copy-of select="$structured_advanced"/>
</result-document>
</if>
</template>
</stylesheet>