Skip to content

Commit 909cb78

Browse files
committed
doc: Further speed improvements for HTML XSLT build
1 parent cd1b215 commit 909cb78

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

doc/src/sgml/stylesheet-speedup-common.xsl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,10 @@
9191
</xsl:choose>
9292
</xsl:template>
9393

94+
<!-- from common/l10n.xsl -->
95+
96+
<!-- Just hardcode the language for the whole document, to make it faster. -->
97+
98+
<xsl:template name="l10n.language">en</xsl:template>
99+
94100
</xsl:stylesheet>

doc/src/sgml/stylesheet-speedup-xhtml.xsl

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,56 @@
251251
</xsl:call-template>
252252
</xsl:template>
253253

254+
<xsl:template name="href.target">
255+
<xsl:param name="context" select="."/>
256+
<xsl:param name="object" select="."/>
257+
<xsl:param name="toc-context" select="."/>
258+
<!-- Optimization for pgsql-docs: Remove support for dbhtml processing
259+
instruction here -->
260+
<xsl:variable name="href.to.uri">
261+
<xsl:call-template name="href.target.uri">
262+
<xsl:with-param name="object" select="$object"/>
263+
</xsl:call-template>
264+
</xsl:variable>
265+
<xsl:variable name="href.from.uri">
266+
<xsl:choose>
267+
<xsl:when test="not($toc-context = .)">
268+
<xsl:call-template name="href.target.uri">
269+
<xsl:with-param name="object" select="$toc-context"/>
270+
</xsl:call-template>
271+
</xsl:when>
272+
<xsl:otherwise>
273+
<xsl:call-template name="href.target.uri">
274+
<xsl:with-param name="object" select="$context"/>
275+
</xsl:call-template>
276+
</xsl:otherwise>
277+
</xsl:choose>
278+
</xsl:variable>
279+
<xsl:variable name="href.to">
280+
<xsl:value-of select="$href.to.uri"/>
281+
</xsl:variable>
282+
<xsl:variable name="href.from">
283+
<xsl:call-template name="trim.common.uri.paths">
284+
<xsl:with-param name="uriA" select="$href.to.uri"/>
285+
<xsl:with-param name="uriB" select="$href.from.uri"/>
286+
<xsl:with-param name="return" select="'B'"/>
287+
</xsl:call-template>
288+
</xsl:variable>
289+
<xsl:variable name="depth">
290+
<xsl:call-template name="count.uri.path.depth">
291+
<xsl:with-param name="filename" select="$href.from"/>
292+
</xsl:call-template>
293+
</xsl:variable>
294+
<xsl:variable name="href">
295+
<xsl:call-template name="copy-string">
296+
<xsl:with-param name="string" select="'../'"/>
297+
<xsl:with-param name="count" select="$depth"/>
298+
</xsl:call-template>
299+
<xsl:value-of select="$href.to"/>
300+
</xsl:variable>
301+
<xsl:value-of select="$href"/>
302+
</xsl:template>
303+
254304
<xsl:template name="html.head">
255305
<xsl:param name="prev" select="/foo"/>
256306
<xsl:param name="next" select="/foo"/>

0 commit comments

Comments
 (0)