Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions xsl/makeSearchPage.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
</xd:doc>
<xsl:output method="xhtml" encoding="UTF-8" normalization-form="NFC"
exclude-result-prefixes="#all" omit-xml-declaration="yes" html-version="5.0"
include-content-type="yes"/>
include-content-type="no"/>

<!--**************************************************************
* *
Expand Down Expand Up @@ -159,22 +159,29 @@
<xd:doc>
<xd:desc>This template detects an HTML head element which does not contain an
existing style element with the id ssCss, and injects one containing the code in
the <xd:ref name="css">$css</xd:ref> parameter. We place it first in the head element
so that any subsequent style element provided by the user can override it.</xd:desc>
the <xd:ref name="css">$css</xd:ref> parameter. We place it early in the head element
so that any subsequent style element provided by the user can override it.
We also take the opportunity to inject a meta[@charset] if there isn't one.
</xd:desc>
</xd:doc>
<xsl:template match="head[not(*[@id='ssCss'])]">
<xsl:template match="head">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<link rel="stylesheet" href="{$output.dir}/ssSearch.css" id="ssCss"/>
<xsl:if test="not(child::meta[@charset])">
<meta charset="UTF-8"/>
</xsl:if>
<xsl:if test="not(*[@id='ssCss'])">
<link rel="stylesheet" href="{$output.dir}/ssSearch.css" id="ssCss"/>
</xsl:if>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>

<xd:doc>
<xd:desc>This suppresses the meta[@charset] element if any, because we
are including the content type in the xsl:output.</xd:desc>
<xd:desc>This suppresses the meta[@http-equiv] element if any, because we
are including the more standard meta[@charset].</xd:desc>
</xd:doc>
<xsl:template match="meta[@charset]"/>
<xsl:template match="meta[@http-equiv eq 'Content-Type']"/>

<xd:doc>
<xd:desc>This is the main template for matching the staticSearch element
Expand Down
28 changes: 21 additions & 7 deletions xsl/spiff_up_documentation.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

<xsl:include href="process_schema_for_config.xsl"/>

<xsl:output method="xhtml" html-version="5.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
<xsl:output method="xhtml" html-version="5.0" encoding="UTF-8" indent="yes"
omit-xml-declaration="yes" include-content-type="no"/>


<!-- Root template. -->
Expand All @@ -46,6 +47,9 @@
<!-- Get rid of pointless itemprop attribute. -->
<xsl:template match="@itemprop"/>

<!-- Get rid of obsolete script/@type attribute. -->
<xsl:template match="script/@type"/>

<!-- Section headers should be h2s. -->
<xsl:template match="section/header/h1 | section/h1">
<h2><xsl:apply-templates select="@*|node()"/></h2>
Expand All @@ -56,10 +60,20 @@
<h3><xsl:apply-templates select="@*|node()"/></h3>
</xsl:template>

<!-- Get rid of the meta charset element, since we already
get the http-equiv one from Saxon and both should not
be present. -->
<xsl:template match="meta[@charset]"/>
<!-- Get rid of the meta[@http-equiv="Content-Type"] in favour of
a cleaner meta[@charset]. -->
<xsl:template match="meta[@http-equiv='Content-Type']"/>

<!-- Insert meta[@charset] if it is not there. -->
<xsl:template match="head">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:if test="not(child::meta[@charset])">
<meta charset="UTF-8"/>
</xsl:if>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>

<!-- Regenerate the title element, cos it gets borked. Also add the viewport meta tag. -->
<xsl:template match="title">
Expand All @@ -80,7 +94,7 @@

<!--Add a little control before the egXML-->
<xsl:template match="div[@id = 'configQuickstart_egXML']">
<input type="checkbox" id="configQuickstart_egXML_control">Show/Hide fillable inputs</input>
<input type="checkbox" id="configQuickstart_egXML_control"/><label for="configQuickstart_egXML_control">Show/Hide fillable inputs</label>
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
Expand Down Expand Up @@ -124,7 +138,7 @@
</select>
</xsl:when>
<xsl:when test="$type = 'nonNegativeInteger'">
<input type="number" min="0" value="{$value}" size="4"/>
<input type="number" min="0" value="{$value}"/>
</xsl:when>
<!--If there's a configured valList (e.g. as it is
for scoringAlgorithm), then create a select list-->
Expand Down
41 changes: 33 additions & 8 deletions xsl/split_documentation.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
<xd:doc>
<xd:desc>Specify we're outputting XHTML 5.</xd:desc>
</xd:doc>
<xsl:output method="xhtml" html-version="5.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
<xsl:output method="xhtml" html-version="5.0" encoding="UTF-8" indent="yes"
omit-xml-declaration="yes" include-content-type="no"/>

<xd:doc>
<xd:desc>The table of contents as generated by the TEI Stylesheets.</xd:desc>
Expand Down Expand Up @@ -54,9 +55,6 @@
</xsl:for-each>
</xsl:template>




<!--INDEX TEMPLATES-->

<xd:doc>
Expand All @@ -77,18 +75,43 @@
<xsl:attribute name="id" select="'index'"/>
</xsl:template>

<xd:doc>
<xd:desc>Add a proper meta tag to replace any meta[@http-equiv] obsolete version.</xd:desc>
</xd:doc>
<xsl:template match="html/head" mode="index">
<xsl:copy>
<xsl:apply-templates select="@*" mode="#current"/>
<xsl:if test="not(child::meta[@charset])">
<meta charset="UTF-8"/>
</xsl:if>
<xsl:apply-templates select="node()" mode="#current"/>
</xsl:copy>
</xsl:template>

<xd:doc>
<xd:desc>Place the document title into the body, and add the staticSearch div.</xd:desc>
</xd:doc>
<xsl:template match="div[contains-token(@class,'tei_body')]" mode="index">
<div>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="@*" mode="#current"/>
<xsl:copy-of select="ancestor::html/descendant::div[contains-token(@class,'docTitle')]"/>
<div id="staticSearch"/>

</div>
</xsl:template>

<!--ALL-DOCUMENT TEMPLATES-->

<xd:doc>
<xd:desc>For all documents: suppress any Content-Type meta tag, in preference for the standard
meta tag we insert below.</xd:desc>
</xd:doc>
<xsl:template match="html/head/meta[@http-equiv eq 'Content-Type']" mode="index section"/>

<xd:doc>
<xd:desc>Get rid of the obsolete @type attribute on script elements.</xd:desc>
</xd:doc>
<xsl:template match="script/@type" mode="index section"/>

<xd:doc>
<xd:desc>Delete the back from all documents.</xd:desc>
</xd:doc>
Expand Down Expand Up @@ -136,7 +159,7 @@
</xd:doc>
<xsl:template match="div[contains-token(@class,'titlePart')][1]" mode="index section">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="@*" mode="#current"/>
<a href="index.html"><xsl:apply-templates select="node()" mode="#current"/></a>
</xsl:copy>
</xsl:template>
Expand Down Expand Up @@ -169,7 +192,6 @@
</xsl:result-document>
</xsl:template>


<xd:doc>
<xd:desc>Add staticSearch metadata to the HTML head for that section.</xd:desc>
<xd:param name="section">Tunneled parameter that contains the section currently being processed.</xd:param>
Expand All @@ -178,6 +200,9 @@
<xsl:param name="section" tunnel="yes"/>
<xsl:variable name="info" select="$section/ul[preceding-sibling::*[1]/self::header][1]" as="element(ul)?"/>
<xsl:copy>
<xsl:if test="not(child::meta[@charset])">
<meta charset="UTF-8"/>
</xsl:if>
<xsl:apply-templates select="@*|node()" mode="#current"/>
<!--Now create the meta tags for static search-->
<xsl:if test="$info">
Expand Down
Loading