Commit 79527ba9 authored by Wendell Piez's avatar Wendell Piez

Documentation

parent 758e3912
<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
xmlns:xsw="http://coko.foundation/xsweet"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0"
type="xsw:html-header-promote" name="html-header-promote">
<p:input port="source" primary="true"/>
<p:input port="parameters" kind="parameter"/>
<p:output port="_Z_FINAL" primary="true">
<p:pipe port="result" step="final"/>
</p:output>
<p:output port="_A_digested" primary="false">
<p:pipe port="result" step="digest-paragraphs"/>
</p:output>
<p:output port="_B_headers-promoted" primary="false">
<p:pipe port="result" step="apply-the-header-mapping-xslt"/>
</p:output>
<p:output port="_X_escalator-xslt" primary="false">
<p:pipe port="result" step="escalator-xslt"/>
</p:output>
<p:serialization port="_A_digested" indent="true" omit-xml-declaration="true"/>
<p:serialization port="_B_headers-promoted" indent="true" omit-xml-declaration="true"/>
<p:serialization port="_X_escalator-xslt" indent="true" omit-xml-declaration="true"/>
<p:serialization port="_Z_FINAL" indent="true" omit-xml-declaration="true"/>
<p:identity name="in"/>
<!-- First, reduce the input to a "weighted profile" of its paragraph styles -->
<p:xslt name="digest-paragraphs">
<p:input port="stylesheet">
<p:document href="digest-paragraphs.xsl"/>
</p:input>
</p:xslt>
<!-- Then generate an XSLT stylesheet from it -->
<p:xslt name="escalator-xslt">
<p:input port="stylesheet">
<p:document href="make-header-escalator-xslt.xsl"/>
</p:input>
</p:xslt>
<!-- We apply the stylesheet we have generated to the original doc -->
<p:xslt name="apply-the-header-mapping-xslt">
<p:input port="source">
<p:pipe port="result" step="in"/>
</p:input><p:input port="stylesheet">
<p:pipe port="result" step="escalator-xslt"/>
</p:input>
</p:xslt>
<p:identity name="final"/>
<!--<p:xslt name="">
<p:input port="stylesheet">
<p:inline>
<xsl:stylesheet version="2.0"
xmlns="http://www.w3.org/1999/xhtml"
xpath-default-namespace="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="#all"/>
</p:inline>
</p:input>
</p:xslt>-->
<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
xmlns:xsw="http://coko.foundation/xsweet"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0"
type="xsw:html-header-promote" name="html-header-promote">
<!-- XSweet: Apply header promotion XSLT chain into a single XProc call -->
<!-- Input: an HTML typescript file with no headers -->
<!-- Output: a copy, with headers promoted -->
<!-- Note: unlike the 'chooser' header promotion macro XSLT, this XProc is wired up to 'property-based' header promotion. -->
<p:input port="source" primary="true"/>
<p:input port="parameters" kind="parameter"/>
<p:output port="_Z_FINAL" primary="true">
<p:pipe port="result" step="final"/>
</p:output>
<p:output port="_A_digested" primary="false">
<p:pipe port="result" step="digest-paragraphs"/>
</p:output>
<p:output port="_B_headers-promoted" primary="false">
<p:pipe port="result" step="apply-the-header-mapping-xslt"/>
</p:output>
<p:output port="_X_escalator-xslt" primary="false">
<p:pipe port="result" step="escalator-xslt"/>
</p:output>
<p:serialization port="_A_digested" indent="true" omit-xml-declaration="true"/>
<p:serialization port="_B_headers-promoted" indent="true" omit-xml-declaration="true"/>
<p:serialization port="_X_escalator-xslt" indent="true" omit-xml-declaration="true"/>
<p:serialization port="_Z_FINAL" indent="true" omit-xml-declaration="true"/>
<p:identity name="in"/>
<!-- First, reduce the input to a "weighted profile" of its paragraph styles -->
<p:xslt name="digest-paragraphs">
<p:input port="stylesheet">
<p:document href="digest-paragraphs.xsl"/>
</p:input>
</p:xslt>
<!-- Then generate an XSLT stylesheet from it -->
<p:xslt name="escalator-xslt">
<p:input port="stylesheet">
<p:document href="make-header-escalator-xslt.xsl"/>
</p:input>
</p:xslt>
<!-- We apply the stylesheet we have generated to the original doc -->
<p:xslt name="apply-the-header-mapping-xslt">
<p:input port="source">
<p:pipe port="result" step="in"/>
</p:input><p:input port="stylesheet">
<p:pipe port="result" step="escalator-xslt"/>
</p:input>
</p:xslt>
<p:identity name="final"/>
<!--<p:xslt name="">
<p:input port="stylesheet">
<p:inline>
<xsl:stylesheet version="2.0"
xmlns="http://www.w3.org/1999/xhtml"
xpath-default-namespace="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="#all"/>
</p:inline>
</p:input>
</p:xslt>-->
</p:declare-step>
\ No newline at end of file
#### digest-paragraphs.xsl
#### header-promotion-CHOOSE.xsl
XSLT stylesheet version 2.0 (11 templates)
XSLT stylesheet version 3.0 (7 templates)
XSweet: paragraph property analysis in support of header promotion: header promotion step 1 [1]
XSweet: top level 'macro XSLT' stylesheet for dynamic dispatch of header promotion logic [1]
Input: an HTML typescript file
Input: an HTML Typescript document (wf)
Output: an XML file showing the results of analysis, for input to `make-header-escalator.xsl`
Output: a copy, with headers promoted according to the logic selected
#### header-promotion-CHOOSE.xsl
Note: runtime parameter `method` may be "ranked-format", "outline-level", or the name of an (XML) configuration file; if the method is not designated the XSLT falls back to "outline-level" (when such headers are detected) or "ranked-format" (when they are not)
XSLT stylesheet version 3.0 (7 templates)
Runtime parameter ``method`` as xs:string
Declared dependency: `make-header-mapper-xslt.xsl`
......@@ -28,26 +28,64 @@ Declared dependency: `digest-paragraphs.xsl`
Declared dependency: `make-header-escalator-xslt.xsl`
#### outline-headers.xsl
XSLT stylesheet version 2.0 (2 templates)
XSweet: Performs header promotion based on outline level [2]
Input: an HTML Typescript document (wf)
Output: a copy, with headers promoted according to outline levels detected on paragraphs
#### digest-paragraphs.xsl
XSLT stylesheet version 2.0 (11 templates)
XSweet: paragraph property analysis in support of header promotion: header promotion step 1 [3a]
Input: an HTML typescript file
Output: an XML file showing the results of analysis, for input to `make-header-escalator.xsl`
Note: not sorting yet these are in arbitrary order.
#### make-header-escalator-xslt.xsl
XSLT stylesheet version 2.0 (2 templates)
XSweet: produces header promotion XSLT from analyzed (crunched) inputs, for the 'property-based' header promotion pathway [3b]
Input: results of running `digest-paragraphs.xsl` on (wf) HTML input
Output: an XSLT suitable for running on the same (original) input to produce a copy with headers promoted
Runtime parameter ``debug-mode`` as xs:string
#### make-header-mapper-xslt.xsl
XSLT stylesheet version 2.0 (4 templates)
#### outline-headers.xsl
XSweet: produces header promotion/mapping XSLT from a configuration file (XML), for the 'mapping-based' header promotion pathway [4]
XSLT stylesheet version 2.0 (2 templates)
Input: A configuration file such as the included `config-mockup.xml`
Output: a copy, with headers promoted according to the mapping
#### html-header-promote.xpl
XProc pipeline version 1.0 (5 steps)
XSweet: Apply header promotion XSLT chain into a single XProc call
Input: an HTML typescript file with no headers
Output: a copy, with headers promoted
Note: unlike the 'chooser' header promotion macro XSLT, this XProc is wired up to 'property-based' header promotion.
Runtime dependency: `digest-paragraphs.xsl`
Runtime dependency: `make-header-escalator-xslt.xsl`
#### config-mockup.xml
#### readme.md
\ No newline at end of file
#### config-mockup.xml
\ No newline at end of file
......@@ -6,6 +6,11 @@
<xsl:output method="xml" indent="no" omit-xml-declaration="yes"/>
<!-- XSweet: A generalized HTML modifier with a configurable driver. Use to clean up and improve HTML. [1] -->
<!-- Input: an HTML typescript file. -->
<!-- Output: a copy, except with tweaks to the HTML as specified by the configuration. -->
<!-- Note: runtime parameter `config` enables naming a config file. Its name must be suffixed `xml`. See the file `html-tweak-map.xml` for an example. The configuration provides for matching elements in the HTML based on regularities in 'style' or 'class' assignment. -->
<xsl:param name="config" as="xs:string" required="yes"/>
<!-- $mapping-spec provides the name of an XML document found at location on $method e.g. method='my-mapping.xml' -->
......
......@@ -8,7 +8,15 @@
exclude-result-prefixes="#all">
<xsl:output method="xml" indent="no" omit-xml-declaration="yes"/>
<!-- XSweet: An *example* of an XSLT produced for the generalized HTML Tweak operation. -->
<!-- Input: (presumably) HTML Typescript -->
<!-- Output: a copy, with (demo) tweaks -->
<!-- Note: This XSLT was produced from (a version of) html-tweak-map.xml as an example of HTML Tweak logic.
It is saved here as a demonstration. -->
<!-- Stylesheet to rewrite style and class on HTML
via a template cascade - i.e., more than a single transformation
can be performed over a single element.
......
......@@ -7,6 +7,9 @@
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="#all">
<!-- XSweet: Library for HTML Tweak XSLTs (must be available at runtime) -->
<!-- Note: this XSLT isn't run on its own: it is, however, included as a module. HTML Tweak depends on its being available. -->
<!-- See html-tweak-demo.xsl for an example of how to use this stylesheet fragment. -->
<xsl:template match="node() | @*">
......
......@@ -5,6 +5,13 @@
<xsl:output indent="yes"/>
<!-- XSweet: Dynamic XSLT production from configuration XML -->
<!-- Input: An HTML Tweak configuration file such as `html-tweak-map.xml` -->
<!-- Output: An XSLT to be applied to HTML Typescript (to achieve the HTML Tweak) -->
<!-- Dependency: the XSLTs produced by this also include file `html-tweak-lib.xsl` so that must be available. -->
<!-- Stylesheet transforms a rough transformation spec for HTML
(affecting @style and @class only) into an XSLT executable.
......
#### APPLY-html-tweaks.xsl
XSLT stylesheet version 3.0 (7 templates)
XSweet: A generalized HTML modifier with a configurable driver. Use to clean up and improve HTML. [1]
Input: an HTML typescript file.
Output: a copy, except with tweaks to the HTML as specified by the configuration.
Note: runtime parameter `config` enables naming a config file. Its name must be suffixed `xml`. See the file `html-tweak-map.xml` for an example. The configuration provides for matching elements in the HTML based on regularities in 'style' or 'class' assignment.
Runtime parameter ``config`` as xs:string
Declared dependency: `make-html-tweak-xslt.xsl`
#### html-tweak-demo.xsl
XSLT stylesheet version 2.0 (3 templates)
XSweet: An *example* of an XSLT produced for the generalized HTML Tweak operation.
Input: (presumably) HTML Typescript
Output: a copy, with (demo) tweaks
Note: This XSLT was produced from (a version of) html-tweak-map.xml as an example of HTML Tweak logic. It is saved here as a demonstration.
Compile-time dependency (xsl:include) `html-tweak-lib.xsl`
#### html-tweak-lib.xsl
XSLT stylesheet version 2.0 (4 templates)
XSweet: Library for HTML Tweak XSLTs (must be available at runtime)
Note: this XSLT isn't run on its own: it is, however, included as a module. HTML Tweak depends on its being available.
#### make-html-tweak-xslt.xsl
XSLT stylesheet version 2.0 (9 templates)
XSweet: Dynamic XSLT production from configuration XML
Input: An HTML Tweak configuration file such as `html-tweak-map.xml`
Output: An XSLT to be applied to HTML Typescript (to achieve the HTML Tweak)
Runtime parameter ``debug-mode`` as xs:string
#### html-tweak.xpl
XProc pipeline version 1.0 (3 steps)
Runtime dependency: `make-html-tweak-xslt.xsl`
#### html-tweak-map.xml
\ No newline at end of file
......@@ -9,6 +9,11 @@
exclude-result-prefixes="#all"
version="3.0">
<!-- XSweet: Flat HTML becomes well structured HTML. This XSLT, using micropipelines, combines the of `mark-sections.xsl` followed by `nest-sections.xsl`, except here in a single XSLT. (Use this one!) [1] -->
<!-- Input: HTML Typescript, with header elements indicating section demarcations -->
<!-- Output: the same, except with the sections marked. -->
<!-- Note: also marks the result with a comment if headers are found out of expected sequence. -->
<xsl:output method="xml" indent="no" omit-xml-declaration="yes"/>
<xsl:template match="node() | @*">
......
#### induce-sections.xsl
XSLT stylesheet version 3.0 (6 templates)
XSweet: Flat HTML becomes well structured HTML. This XSLT, using micropipelines, combines the of `mark-sections.xsl` followed by `nest-sections.xsl`, except here in a single XSLT. (Use this one!) [1]
Input: HTML Typescript, with header elements indicating section demarcations
Output: the same, except with the sections marked.
Note: also marks the result with a comment if headers are found out of expected sequence.
#### mark-sections.xsl
XSLT stylesheet version 2.0 (3 templates)
XSweet: half of header promotion: marking the sections [2]
#### nest-sections.xsl
XSLT stylesheet version 2.0 (4 templates)
XSweet: the second half of the section induction two-step. [3]
#### scratch-cleanup.xsl
XSLT stylesheet version 2.0 (4 templates)
XSweet: an example cleanup transformation.
#### docx-to-elevated-indented.xpl
XProc pipeline version 1.0 (3 steps)
Runtime dependency: `../XSweet/applications/html-polish/final-rinse.xsl`
Runtime dependency: `../XSweet/applications/css-abstract/css-abstract.xsl`
#### xsweet-elevation-filter.xpl
XProc pipeline version 1.0 (4 steps)
Runtime dependency: `mark-sections.xsl`
Runtime dependency: `nest-sections.xsl`
Runtime dependency: `scratch-cleanup.xsl`
\ No newline at end of file
......@@ -8,6 +8,7 @@
exclude-result-prefixes="#all">
<!-- XSweet: half of header promotion: marking the sections -->
<xsl:output method="xml" indent="no" omit-xml-declaration="yes"/>
<xsl:template match="node() | @*">
......
......@@ -8,6 +8,7 @@
exclude-result-prefixes="#all">
<!-- XSweet: the second half of the section induction two-step. [3] -->
<xsl:output method="xml" indent="no" omit-xml-declaration="yes"/>
<xsl:template match="node() | @*">
......
......@@ -9,6 +9,8 @@
<xsl:output method="xml" indent="no" omit-xml-declaration="yes"/>
<!-- XSweet: an example cleanup transformation. -->
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment