Skip to content
Draft
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Mac Finder files
.DS_Store
htmlbook-xsl/xspec/xspec/*
13 changes: 8 additions & 5 deletions htmlbook-xsl/chunk.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@ sect5:s
<xsl:value-of select="@href"/>
</xsl:with-param>
</xsl:call-template>
<!-- Oh well, just copy any existing href to output -->
<xsl:apply-templates select="@href"/>
<!-- Use calculated-output-href to normalize the href (prepend # if missing, strip filename for file/id refs) -->
<xsl:attribute name="href"><xsl:value-of select="$calculated-output-href"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
Expand Down Expand Up @@ -416,6 +416,7 @@ sect5:s
(contains(@data-type, 'footnoteref')) or
(contains(@data-type, 'indexterm')))][@href]">
<xsl:param name="url.in.parens" select="$url.in.parens"/>
<xsl:param name="autogenerate.xref.pagenum.style" select="$autogenerate.xref.pagenum.style"/>
<!-- If the element is empty, does not have data-type="link", and is a valid XREF, go ahead and treat it like an <a> element with data-type="xref" -->
<xsl:variable name="is-xref">
<xsl:call-template name="href-is-xref">
Expand All @@ -432,7 +433,9 @@ sect5:s
<xsl:when test="(not(node())) and
($is-xref = 1) and
not(@data-type='link')">
<xsl:call-template name="process-as-xref"/>
<xsl:call-template name="process-as-xref">
<xsl:with-param name="autogenerate.xref.pagenum.style" select="$autogenerate.xref.pagenum.style"/>
</xsl:call-template>
</xsl:when>
<!-- Else if href is not external hyperlink, then process href -->
<xsl:when test="$is-xref = 1">
Expand All @@ -456,8 +459,8 @@ sect5:s
<xsl:value-of select="@href"/>
</xsl:with-param>
</xsl:call-template>
<!-- Oh well, just copy any existing href to output -->
<xsl:value-of select="@href"/>
<!-- Use calculated-output-href to normalize the href (prepend # if missing, strip filename for file/id refs) -->
<xsl:value-of select="$calculated-output-href"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
Expand Down
6 changes: 6 additions & 0 deletions htmlbook-xsl/epub.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@

<xsl:param name="metadata.creators" select="//h:head/h:meta[contains(@name, 'creator') or contains(@name, 'author')]"/>

<xsl:param name="access.mode" select="''"/>
<xsl:param name="access.mode.sufficient" select="''"/>
<xsl:param name="accessibility.feature" select="''"/>
<xsl:param name="accessibility.hazard" select="''"/>
<xsl:param name="accessibility.summary" select="''"/>

<!-- Id to use to reference cover image -->
<xsl:param name="epub.cover.image.id" select="'cover-image'"/>

Expand Down
7 changes: 3 additions & 4 deletions htmlbook-xsl/functions-xslt2.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
xmlns:exsl="http://exslt.org/common"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:htmlbook="https://github.com/oreillymedia/HTMLBook"
xmlns:set="http://exslt.org/sets"
xmlns="http://www.w3.org/1999/xhtml"
extension-element-prefixes="exsl set"
exclude-result-prefixes="exsl h set">
extension-element-prefixes="exsl"
exclude-result-prefixes="exsl h">

<xsl:function name="htmlbook:is-chunk">
<xsl:param name="node"/>
Expand Down Expand Up @@ -49,7 +48,7 @@
<xsl:variable name="self-and-ancestors" select="$node/ancestor-or-self::*"/>

<!-- 2. Find out which of these "self and ancestors" are also chunks -->
<xsl:variable name="self-and-ancestors-that-are-chunks" select="set:intersection($self-and-ancestors, $chunks)"/>
<xsl:variable name="self-and-ancestors-that-are-chunks" select="$self-and-ancestors intersect $chunks"/>

<!-- 3. Desired chunk is the last (lowest in hierarchy) in this nodeset -->
<xsl:variable name="chunk.node" select="$self-and-ancestors-that-are-chunks[last()]"/>
Expand Down
14 changes: 11 additions & 3 deletions htmlbook-xsl/htmlbook.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,17 @@
<xsl:include href="indexgen.xsl"/> <!-- Autogeneration of index if specified in autogenerate-index -->
<xsl:include href="xrefgen.xsl"/> <!-- Autogeneration of XREFs if specified in autogenerate-xrefs -->

<xsl:include href="functions-exsl.xsl"/> <!-- Functions that are compatible with exsl package -->
<!-- If you are using an XSLT 2.0 processor, comment out the above include and uncomment the following include -->
<!-- <xsl:include href="functions-xslt2.xsl"/> --> <!-- Functions that are compatible with XSLT 2.0 processors -->
<!-- Two implementations of HTMLBook functions are provided:
- functions-exsl.xsl: EXSL func:function syntax, used in production via lxml/libxslt
(the HTMLBook -> EPUB/chunked HTML pipeline in orm-atlas-workers)
- functions-xslt2.xsl: xsl:function syntax, used by the XSpec test suite (Saxon HE 12.5)
and also compatible with the Saxon-based DocBook -> HTMLBook pipeline.
Both files implement identical logic. If you modify one, update the other.
Production (lxml/libxslt) uses this file: -->
<xsl:include href="functions-exsl.xsl"/>
<!-- The XSpec test suite uses functions-xslt2.xsl instead; see xspec files for chunk.xsl,
epub.xsl, and htmlbook.xsl entry points. -->
<!-- <xsl:include href="functions-xslt2.xsl"/> -->

<xsl:output method="xml"
encoding="UTF-8"/>
Expand Down
Loading