2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:xslo="http://www.w3.org/1999/XSL/TransformAlias"
4 xmlns:fo="http://www.w3.org/1999/XSL/Format"
5 exclude-result-prefixes="fo"
8 <xsl:include href="../lib/lib.xsl"/>
10 <xsl:output method="xml" encoding="US-ASCII"/>
12 <xsl:namespace-alias stylesheet-prefix="xslo" result-prefix="xsl"/>
14 <xsl:preserve-space elements="*"/>
16 <xsl:template match="/">
17 <xsl:comment>This file was created automatically by xsl2profile</xsl:comment>
18 <xsl:comment>from the DocBook XSL stylesheets.</xsl:comment>
19 <xsl:apply-templates/>
22 <!-- Make sure we override some templates and parameters appropriately for XHTML -->
23 <xsl:template match="xsl:stylesheet">
25 <xsl:attribute name="exslt:dummy" xmlns:exslt="http://exslt.org/common">dummy</xsl:attribute>
26 <xsl:attribute name="ng:dummy" xmlns:ng="http://docbook.org/docbook-ng">dummy</xsl:attribute>
27 <xsl:attribute name="db:dummy" xmlns:db="http://docbook.org/ns/docbook">dummy</xsl:attribute>
28 <xsl:if test="not(@extension-element-prefixes)">
29 <xsl:attribute name="extension-element-prefixes">exslt</xsl:attribute>
31 <xsl:if test="not(@exclude-result-prefixes)">
32 <xsl:attribute name="exclude-result-prefixes">exslt</xsl:attribute>
34 <xsl:for-each select="@*">
36 <xsl:when test="local-name(.) = 'extension-element-prefixes' or
37 local-name(.) = 'exclude-result-prefixes'">
38 <xsl:attribute name="{local-name(.)}"><xsl:value-of select="concat(., ' exslt')"/></xsl:attribute>
41 <xsl:attribute name="{local-name(.)}"><xsl:value-of select="."/></xsl:attribute>
45 <xsl:apply-templates/>
49 <xsl:template match="*">
51 <xsl:copy-of select="@*"/>
52 <xsl:apply-templates/>
56 <xsl:template match="comment()|processing-instruction()|text()">
60 <xsl:template match="xsl:template[@match='/']">
61 <xslo:include href="../profiling/profile-mode.xsl"/>
62 <xslo:variable name="profiled-content">
64 <xslo:when test="*/self::ng:* or */self::db:*">
65 <xslo:message>Note: namesp. cut : stripped namespace before processing</xslo:message>
66 <xslo:variable name="stripped-content">
67 <xslo:apply-templates select="/" mode="stripNS"/>
69 <xslo:message>Note: namesp. cut : processing stripped document</xslo:message>
70 <xslo:apply-templates select="exslt:node-set($stripped-content)" mode="profile"/>
73 <xslo:apply-templates select="/" mode="profile"/>
77 <xslo:variable name="profiled-nodes" select="exslt:node-set($profiled-content)"/>
79 <xsl:copy-of select="@*"/>
80 <xsl:apply-templates mode="correct"/>
84 <xsl:template match="xsl:template[@name='hhc-main' or @name='hhp-main' or @name='hhk' or @name='hh-map' or @name='hh-alias' or @name='etoc'] | xsl:variable[@name='raw.help.title']">
86 <xsl:copy-of select="@*"/>
87 <xsl:apply-templates mode="correct"/>
91 <xsl:template match="*[starts-with(@select, '/')]" mode="correct">
93 <xsl:for-each select="@*">
95 <xsl:when test="local-name(.) = 'select' and string(.) = '/'">
96 <xsl:attribute name="{local-name(.)}">$profiled-nodes</xsl:attribute>
98 <xsl:when test="local-name(.) = 'select' and starts-with(., '/')">
99 <xsl:attribute name="{local-name(.)}">$profiled-nodes<xsl:value-of select="."/></xsl:attribute>
102 <xsl:attribute name="{local-name(.)}"><xsl:value-of select="."/></xsl:attribute>
106 <xsl:apply-templates mode="correct"/>
110 <xsl:template match='*[contains(@*, "key('id',$rootid)")]' mode="correct" priority="2">
112 <xsl:for-each select="@*">
114 <xsl:when test='contains(., "key('id',$rootid)")'>
115 <xsl:attribute name="{local-name(.)}">
116 <xsl:call-template name="string.subst">
117 <xsl:with-param name="string" select="."/>
118 <xsl:with-param name="target">key('id',$rootid)</xsl:with-param>
119 <xsl:with-param name="replacement">$profiled-nodes//*[@id=$rootid]</xsl:with-param>
124 <xsl:attribute name="{local-name(.)}"><xsl:value-of select="."/></xsl:attribute>
128 <xsl:apply-templates mode="correct"/>
132 <!-- FO stylesheet has apply-templates without select, we must detect it by context -->
133 <xsl:template match="fo:root//xsl:apply-templates" mode="correct">
135 <xsl:copy-of select="@*"/>
136 <xsl:attribute name="select">$profiled-nodes/node()</xsl:attribute>
137 <xsl:apply-templates mode="correct"/>
141 <!-- DB5 namespace stripping is already done -->
142 <xsl:template match="xsl:when[contains(@test, 'self::db')]" mode="correct">
144 <xsl:attribute name="test">false()</xsl:attribute>
148 <xsl:template match="*" mode="correct">
150 <xsl:copy-of select="@*"/>
151 <xsl:apply-templates mode="correct"/>
155 <xsl:template match="comment()|processing-instruction()|text()" mode="correct">