summaryrefslogtreecommitdiff
path: root/docs/xslt/docbook2pearson.xsl
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2004-12-07 16:54:57 +0000
committerGerald W. Carter <jerry@samba.org>2008-04-23 08:46:09 -0500
commitca63ae57c0f25def3f7dcf3264d91f93285e739b (patch)
tree58fd47b639481a6a7cfda14975cd0766290482c8 /docs/xslt/docbook2pearson.xsl
parent9cab43f5b9a7da5912d4478b0d461653ec4d38a6 (diff)
downloadsamba-ca63ae57c0f25def3f7dcf3264d91f93285e739b.tar.gz
samba-ca63ae57c0f25def3f7dcf3264d91f93285e739b.tar.bz2
samba-ca63ae57c0f25def3f7dcf3264d91f93285e739b.zip
- Fix manpage index file (#2109)
- Fix plucker (Palm Documentation Format) output (This used to be commit 8a4ab0776b5905d792116706a0de4ffbbb315f4b)
Diffstat (limited to 'docs/xslt/docbook2pearson.xsl')
-rw-r--r--docs/xslt/docbook2pearson.xsl104
1 files changed, 69 insertions, 35 deletions
diff --git a/docs/xslt/docbook2pearson.xsl b/docs/xslt/docbook2pearson.xsl
index d276d31991..4a4158fa40 100644
--- a/docs/xslt/docbook2pearson.xsl
+++ b/docs/xslt/docbook2pearson.xsl
@@ -53,7 +53,7 @@
</xsl:if>
</xsl:template>
- <xsl:template match="/">
+ <xsl:template match="/" mode="default">
<xsl:processing-instruction
name="xml-stylesheet">href="pearson.css"
type="text/css"</xsl:processing-instruction>
@@ -85,24 +85,30 @@
</bookinfo>
</xsl:template>
- <xsl:template match="bookinfo/author">
- <!-- author>
- <xsl:apply-templates/>
- </author -->
-</xsl:template>
+ <xsl:template match="author">
+ <author>
+ <xsl:apply-templates/>
+ </author>
+ </xsl:template>
-<xsl:template match="chapter">
- <chapter>
- <xsl:call-template name="transform.id.attribute"/>
- <xsl:apply-templates/>
- </chapter>
-</xsl:template>
+ <xsl:template match="editor">
+ <editor>
+ <xsl:apply-templates/>
+ </editor>
+ </xsl:template>
+
+ <xsl:template match="chapter">
+ <chapter>
+ <xsl:call-template name="transform.id.attribute"/>
+ <xsl:apply-templates/>
+ </chapter>
+ </xsl:template>
-<xsl:template match="chapter/title/command">
- <xsl:apply-templates/>
-</xsl:template>
+ <xsl:template match="chapter/title/command">
+ <xsl:apply-templates/>
+ </xsl:template>
- <xsl:template match="index">
+ <xsl:template match="index">
<xsl:comment> XXX insert index here </xsl:comment>
</xsl:template>
@@ -154,16 +160,54 @@
<title><xsl:apply-templates/></title>
</xsl:template>
+ <xsl:param name="notpchilds" select="'variablelist itemizedlist orderedlist'"/>
+
+ <xsl:template match="para">
+ <!-- loop thru all elements: -->
+ <xsl:for-each select="*|text()">
+ <xsl:choose>
+ <xsl:when test="string-length(name(.)) > 0 and contains($notpchilds,name(.))">
+ <xsl:message><xsl:text>Removing from p:</xsl:text><xsl:value-of select="name(.)"/></xsl:message>
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="hstartpara"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
- <xsl:template match="para">
- <p><xsl:apply-templates/></p>
- <!-- p><xsl:apply-templates><value-of
- select="normalize-space()"/></xsl:apply-templates></p -->
- </xsl:template>
+ <!-- Do open paragraph when previous sibling was not a valid p child -->
+ <xsl:template name="hstartpara">
+ <xsl:if test="not(preceding-sibling::*[1]) or (contains($notpchilds,name(preceding-sibling::*[1])) and not(string-length(name(.)) > 0))">
+ <p>
+ <xsl:apply-templates select="."/>
+ <xsl:for-each select="following-sibling::*[not(contains($notpchilds,name(.)) and string-length(name(.)) > 0)]">
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </p>
+ </xsl:if>
+ </xsl:template>
- <xsl:template match="tip">
- <tip><xsl:apply-templates/></tip>
- </xsl:template>
+ <xsl:template name="hsubpara">
+ <xsl:param name="data"/>
+ <xsl:apply-templates select="$data"/>
+ <xsl:if test="$data[following-sibling::*[1]]">
+ <xsl:param name="next" select="$data[following-sibling::*[1]]"/>
+ <xsl:message><xsl:value-of select="name(.)"/></xsl:message>
+ <xsl:if test="$next and (not(contains($notpchilds,name($next))) or $next[text()])">
+ <xsl:message><xsl:text>Followed by : </xsl:text><xsl:value-of select="name($next)"/></xsl:message>
+ <xsl:call-template name="hsubpara">
+ <xsl:with-param name="data" select="$next"/>
+ </xsl:call-template>
+ <xsl:message><xsl:text>Done Followed by : </xsl:text><xsl:value-of select="name($next)"/></xsl:message>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="tip">
+ <tip><xsl:apply-templates/></tip>
+ </xsl:template>
<xsl:template match="warning|important|caution">
<stop><xsl:apply-templates/></stop>
@@ -819,18 +863,8 @@
match="quote"><quote><xsl:apply-templates/></quote></xsl:template -->
- <!-- Literaturverzeichnis -->
- <xsl:template match="author">
- <xsl:apply-templates/>,
- </xsl:template>
-
- <xsl:template match="editor">
- <!--FIXME: More information referring to editor ? -->
- <xsl:apply-templates/>,
- </xsl:template>
-
<xsl:template match="othername">
- <xsl:apply-templates/>
+ <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>0
</xsl:template>
<xsl:template match="firstname">
<xsl:apply-templates/><xsl:text> </xsl:text>