mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-08-03 10:05:31 +01:00
* Adding the forgotten stylesheets
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@3436 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
parent
673b0d84ba
commit
0c43171dd1
135
stylesheets/pdf/lfs-index.xsl
Normal file
135
stylesheets/pdf/lfs-index.xsl
Normal file
@ -0,0 +1,135 @@
|
||||
<?xml version='1.0' encoding='ISO-8859-1'?>
|
||||
<!DOCTYPE xsl:stylesheet [
|
||||
<!ENTITY lowercase "'abcdefghijklmnopqrstuvwxyz'">
|
||||
<!ENTITY uppercase "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'">
|
||||
<!ENTITY primary 'normalize-space(concat(primary/@sortas, primary[not(@sortas)]))'>
|
||||
<!ENTITY scope 'count(ancestor::node()|$scope) = count(ancestor::node())'>
|
||||
]>
|
||||
|
||||
<!-- Version 0.8.0 - Manuel Canales Esparcia <macana@lfs-es.org> -->
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
version="1.0">
|
||||
|
||||
<!--Index Stuff-->
|
||||
|
||||
<!--Only one column to fit the targets titles-->
|
||||
<xsl:param name="column.count.index" select="1"></xsl:param>
|
||||
|
||||
<!--Title-->
|
||||
<xsl:template match="index" mode="title.markup">
|
||||
<xsl:param name="allow-anchors" select="0"/>
|
||||
<xsl:text>Index of packages and important installed files</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Divisions-->
|
||||
<xsl:template match="indexterm" mode="index-div">
|
||||
<xsl:param name="scope" select="."/>
|
||||
<xsl:variable name="key"
|
||||
select="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
|
||||
<xsl:variable name="divtitle" select="translate($key, &lowercase;, &uppercase;)"/>
|
||||
<xsl:if test="key('letter', $key)[&scope;]
|
||||
[count(.|key('primary', &primary;)[&scope;][1]) = 1]">
|
||||
<fo:block>
|
||||
<xsl:if test="contains(concat(&lowercase;, &uppercase;), $key)">
|
||||
<xsl:call-template name="indexdiv.title">
|
||||
<xsl:with-param name="titlecontent">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$divtitle = 'A'">
|
||||
<xsl:text>Packages</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="$divtitle = 'B'">
|
||||
<xsl:text>Programs</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="$divtitle = 'C'">
|
||||
<xsl:text>Libraries</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="$divtitle = 'D'">
|
||||
<xsl:text>Scripts</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="$divtitle = 'E'">
|
||||
<xsl:text>Others</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$divtitle"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
<fo:block>
|
||||
<xsl:apply-templates select="key('letter', $key)[&scope;]
|
||||
[count(.|key('primary', &primary;)[&scope;][1])=1]"
|
||||
mode="index-primary">
|
||||
<xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
||||
<xsl:with-param name="scope" select="$scope"/>
|
||||
</xsl:apply-templates>
|
||||
</fo:block>
|
||||
</fo:block>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- The separator -->
|
||||
<xsl:template match="indexterm" mode="reference">
|
||||
<xsl:param name="scope" select="."/>
|
||||
<xsl:text>: </xsl:text>
|
||||
<xsl:call-template name="reference">
|
||||
<xsl:with-param name="zones" select="normalize-space(@zone)"/>
|
||||
<xsl:with-param name="scope" select="$scope"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Targets titles and bookmarks-->
|
||||
<xsl:template name="reference">
|
||||
<xsl:param name="scope" select="."/>
|
||||
<xsl:param name="zones"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($zones, ' ')">
|
||||
<xsl:variable name="zone" select="substring-before($zones, ' ')"/>
|
||||
<xsl:variable name="zone2" select="substring-after($zones, ' ')"/>
|
||||
<xsl:variable name="target" select="key('id', $zone)[&scope;]"/>
|
||||
<xsl:variable name="target2" select="key('id', $zone2)[&scope;]"/>
|
||||
<xsl:variable name="id">
|
||||
<xsl:call-template name="object.id">
|
||||
<xsl:with-param name="object" select="$target[1]"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="id2">
|
||||
<xsl:call-template name="object.id">
|
||||
<xsl:with-param name="object" select="$target2[1]"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<fo:basic-link internal-destination="{$id}">
|
||||
<xsl:value-of select="$target/title"/>
|
||||
<xsl:apply-templates select="$target" mode="page.citation">
|
||||
<xsl:with-param name="id" select="$id"/>
|
||||
</xsl:apply-templates>
|
||||
</fo:basic-link>
|
||||
<xsl:text>, </xsl:text>
|
||||
<fo:basic-link internal-destination="{$id2}">
|
||||
<xsl:text>description</xsl:text>
|
||||
<xsl:apply-templates select="$target2" mode="page.citation">
|
||||
<xsl:with-param name="id" select="$id2"/>
|
||||
</xsl:apply-templates>
|
||||
</fo:basic-link>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:variable name="zone" select="$zones"/>
|
||||
<xsl:variable name="target" select="key('id', $zone)[&scope;]"/>
|
||||
<xsl:variable name="id">
|
||||
<xsl:call-template name="object.id">
|
||||
<xsl:with-param name="object" select="$target[1]"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<fo:basic-link internal-destination="{$id}">
|
||||
<xsl:value-of select="$target/title"/>
|
||||
<xsl:apply-templates select="$target" mode="page.citation">
|
||||
<xsl:with-param name="id" select="$id"/>
|
||||
</xsl:apply-templates>
|
||||
</fo:basic-link>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
177
stylesheets/xhtml/lfs-index.xsl
Normal file
177
stylesheets/xhtml/lfs-index.xsl
Normal file
@ -0,0 +1,177 @@
|
||||
<?xml version='1.0' encoding='ISO-8859-1'?>
|
||||
<!DOCTYPE xsl:stylesheet [
|
||||
<!ENTITY lowercase "'abcdefghijklmnopqrstuvwxyz'">
|
||||
<!ENTITY uppercase "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'">
|
||||
<!ENTITY primary 'normalize-space(concat(primary/@sortas, primary[not(@sortas)]))'>
|
||||
<!ENTITY scope 'count(ancestor::node()|$scope) = count(ancestor::node())'>
|
||||
]>
|
||||
|
||||
<!-- Version 0.8.0 - Manuel Canales Esparcia <macana@lfs-es.org> -->
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
version="1.0">
|
||||
|
||||
<!--Index Stuff-->
|
||||
|
||||
<!--Filename-->
|
||||
<xsl:template match="index" mode="recursive-chunk-filename">
|
||||
<xsl:text>longindex.html</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<!--Title-->
|
||||
<xsl:template match="index" mode="title.markup">
|
||||
<xsl:param name="allow-anchors" select="0"/>
|
||||
<xsl:text>Index of packages and important installed files</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<!--Divisions-->
|
||||
<xsl:template match="indexterm" mode="index-div">
|
||||
<xsl:param name="scope" select="."/>
|
||||
<xsl:variable name="key" select="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
|
||||
<xsl:variable name="divtitle" select="translate($key, &lowercase;, &uppercase;)"/>
|
||||
<!-- Make sure that we don't generate a div if there are no terms in scope -->
|
||||
<xsl:if test="key('letter', $key)[&scope;] [count(.|key('primary', &primary;)[&scope;][1]) = 1]">
|
||||
<div class="indexdiv">
|
||||
<xsl:if test="contains(concat(&lowercase;, &uppercase;), $key)">
|
||||
<h2>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$divtitle = 'A'">
|
||||
<xsl:text>Packages</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="$divtitle = 'B'">
|
||||
<xsl:text>Programs</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="$divtitle = 'C'">
|
||||
<xsl:text>Libraries</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="$divtitle = 'D'">
|
||||
<xsl:text>Scripts</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="$divtitle = 'E'">
|
||||
<xsl:text>Others</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$divtitle"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</h2>
|
||||
</xsl:if>
|
||||
<ul>
|
||||
<xsl:apply-templates select="key('letter', $key)[&scope;]
|
||||
[count(.|key('primary', &primary;)[&scope;][1])=1]" mode="index-primary">
|
||||
<xsl:with-param name="scope" select="$scope"/>
|
||||
<xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
||||
</xsl:apply-templates>
|
||||
</ul>
|
||||
</div>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Dropping the separator from here-->
|
||||
<xsl:template match="indexterm" mode="reference">
|
||||
<xsl:param name="scope" select="."/>
|
||||
<xsl:call-template name="reference">
|
||||
<xsl:with-param name="zones" select="normalize-space(@zone)"/>
|
||||
<xsl:with-param name="scope" select="$scope"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Changing the output tags and re-addind the separator-->
|
||||
<xsl:template match="indexterm" mode="index-primary">
|
||||
<xsl:param name="scope" select="."/>
|
||||
<xsl:variable name="key" select="&primary;"/>
|
||||
<xsl:variable name="refs" select="key('primary', $key)[&scope;]"/>
|
||||
<li>
|
||||
<strong class="item">
|
||||
<xsl:value-of select="primary"/>
|
||||
<xsl:text>: </xsl:text>
|
||||
</strong>
|
||||
<xsl:for-each select="$refs[generate-id() = generate-id(key('primary-section',
|
||||
concat($key, " ", generate-id((ancestor-or-self::book |ancestor-or-self::part
|
||||
|ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface
|
||||
|ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3
|
||||
|ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::index)[last()])))[&scope;][1])]">
|
||||
<xsl:apply-templates select="." mode="reference">
|
||||
<xsl:with-param name="scope" select="$scope"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:for-each>
|
||||
<xsl:if test="$refs/secondary">
|
||||
<ul>
|
||||
<xsl:apply-templates select="$refs[secondary and count(.|key('secondary',
|
||||
concat($key, " ", normalize-space(concat(secondary/@sortas,
|
||||
secondary[not(@sortas)]))))[&scope;][1]) = 1]" mode="index-secondary">
|
||||
<xsl:with-param name="scope" select="$scope"/>
|
||||
<xsl:sort select="translate(normalize-space(concat(secondary/@sortas,
|
||||
secondary[not(@sortas)])), &lowercase;, &uppercase;)"/>
|
||||
</xsl:apply-templates>
|
||||
</ul>
|
||||
</xsl:if>
|
||||
</li>
|
||||
</xsl:template>
|
||||
<xsl:template match="indexterm" mode="index-secondary">
|
||||
<xsl:param name="scope" select="."/>
|
||||
<xsl:variable name="key" select="concat(&primary;, " ",
|
||||
normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])))"/>
|
||||
<xsl:variable name="refs" select="key('secondary', $key)[&scope;]"/>
|
||||
<li>
|
||||
<strong class="secitem">
|
||||
<xsl:value-of select="secondary"/>
|
||||
<xsl:text>: </xsl:text>
|
||||
</strong>
|
||||
<xsl:for-each select="$refs[generate-id() = generate-id(key('secondary-section',
|
||||
concat($key, " ", generate-id((ancestor-or-self::book |ancestor-or-self::part
|
||||
|ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface
|
||||
|ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3
|
||||
|ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::index)[last()])))[&scope;][1])]">
|
||||
<xsl:apply-templates select="." mode="reference">
|
||||
<xsl:with-param name="scope" select="$scope"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:for-each>
|
||||
</li>
|
||||
</xsl:template>
|
||||
|
||||
<!--Links (This template also fix a bug in the original code)-->
|
||||
<xsl:template name="reference">
|
||||
<xsl:param name="scope" select="."/>
|
||||
<xsl:param name="zones"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($zones, ' ')">
|
||||
<xsl:variable name="zone" select="substring-before($zones, ' ')"/>
|
||||
<xsl:variable name="zone2" select="substring-after($zones, ' ')"/>
|
||||
<xsl:variable name="target" select="key('sections', $zone)[&scope;]"/>
|
||||
<xsl:variable name="target2" select="key('sections', $zone2)[&scope;]"/>
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:call-template name="href.target.uri">
|
||||
<xsl:with-param name="object" select="$target[1]"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<xsl:apply-templates select="$target[1]" mode="index-title-content"/>
|
||||
</a>
|
||||
<xsl:text> -- </xsl:text>
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:call-template name="href.target.uri">
|
||||
<xsl:with-param name="object" select="$target2[1]"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<xsl:text>description</xsl:text>
|
||||
</a>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:variable name="zone" select="$zones"/>
|
||||
<xsl:variable name="target" select="key('sections', $zone)[&scope;]"/>
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:call-template name="href.target.uri">
|
||||
<xsl:with-param name="object" select="$target[1]"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<xsl:apply-templates select="$target[1]" mode="index-title-content"/>
|
||||
</a>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
110
stylesheets/xhtml/lfs-toc.xsl
Normal file
110
stylesheets/xhtml/lfs-toc.xsl
Normal file
@ -0,0 +1,110 @@
|
||||
<?xml version='1.0' encoding='ISO-8859-1'?>
|
||||
|
||||
<!-- Version 0.8.0 - Manuel Canales Esparcia <macana@lfs-es.org> -->
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
version="1.0">
|
||||
|
||||
|
||||
<!--TOC stuff-->
|
||||
<xsl:param name="generate.toc">
|
||||
appendix toc
|
||||
book toc,title,figure,table,example,equation
|
||||
chapter nop
|
||||
part toc
|
||||
preface nop
|
||||
qandadiv nop
|
||||
qandaset nop
|
||||
reference nop
|
||||
sect1 nop
|
||||
sect2 nop
|
||||
sect3 nop
|
||||
sect4 nop
|
||||
sect5 nop
|
||||
section nop
|
||||
set nop
|
||||
</xsl:param>
|
||||
|
||||
<xsl:param name="toc.section.depth">1</xsl:param>
|
||||
|
||||
<xsl:param name="toc.max.depth">3</xsl:param>
|
||||
|
||||
<!-- Type of list-->
|
||||
<xsl:param name="toc.list.type">ul</xsl:param>
|
||||
|
||||
<!--Adding the h* tags and dropping redundats links-->
|
||||
<xsl:template name="toc.line">
|
||||
<xsl:param name="toc-context" select="."/>
|
||||
<xsl:param name="depth" select="1"/>
|
||||
<xsl:param name="depth.from.context" select="8"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="local-name(.) = 'sect1'">
|
||||
<span>
|
||||
<xsl:attribute name="class"><xsl:value-of select="local-name(.)"/></xsl:attribute>
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:call-template name="href.target">
|
||||
<xsl:with-param name="context" select="$toc-context"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<xsl:apply-templates select="." mode="titleabbrev.markup"/>
|
||||
</a>
|
||||
</span>
|
||||
</xsl:when>
|
||||
<xsl:when test="local-name(.) = 'chapter' or local-name(.) = 'preface'">
|
||||
<h4>
|
||||
<span>
|
||||
<xsl:attribute name="class"><xsl:value-of select="local-name(.)"/></xsl:attribute>
|
||||
<xsl:variable name="label">
|
||||
<xsl:apply-templates select="." mode="label.markup"/>
|
||||
</xsl:variable>
|
||||
<xsl:copy-of select="$label"/>
|
||||
<xsl:if test="$label != ''">
|
||||
<xsl:value-of select="$autotoc.label.separator"/>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="." mode="titleabbrev.markup"/>
|
||||
</span>
|
||||
</h4>
|
||||
</xsl:when>
|
||||
<xsl:when test="local-name(.) = 'part'">
|
||||
<h3>
|
||||
<span>
|
||||
<xsl:attribute name="class"><xsl:value-of select="local-name(.)"/></xsl:attribute>
|
||||
<xsl:variable name="label">
|
||||
<xsl:apply-templates select="." mode="label.markup"/>
|
||||
</xsl:variable>
|
||||
<xsl:copy-of select="$label"/>
|
||||
<xsl:if test="$label != ''">
|
||||
<xsl:value-of select="$autotoc.label.separator"/>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="." mode="titleabbrev.markup"/>
|
||||
</span>
|
||||
</h3>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<h3>
|
||||
<span>
|
||||
<xsl:attribute name="class"><xsl:value-of select="local-name(.)"/></xsl:attribute>
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:call-template name="href.target">
|
||||
<xsl:with-param name="context" select="$toc-context"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<xsl:variable name="label">
|
||||
<xsl:apply-templates select="." mode="label.markup"/>
|
||||
</xsl:variable>
|
||||
<xsl:copy-of select="$label"/>
|
||||
<xsl:if test="$label != ''">
|
||||
<xsl:value-of select="$autotoc.label.separator"/>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="." mode="titleabbrev.markup"/>
|
||||
</a>
|
||||
</span>
|
||||
</h3>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
Loading…
Reference in New Issue
Block a user