1 | <?xml version='1.0' encoding='ISO-8859-1'?>
|
---|
2 |
|
---|
3 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
4 | xmlns:exsl="http://exslt.org/common"
|
---|
5 | exclude-result-prefixes="exsl"
|
---|
6 | version="1.0">
|
---|
7 |
|
---|
8 | <xsl:import href="http://docbook.sourceforge.net/release/xsl/1.67.2/xhtml/profile-chunk-code.xsl"/>
|
---|
9 |
|
---|
10 | <xsl:key name="id" match="*" use="@xml:id"/>
|
---|
11 |
|
---|
12 |
|
---|
13 | <xsl:template match="/">
|
---|
14 | <xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-content">
|
---|
15 | <xslo:apply-templates select="." mode="profile"/>
|
---|
16 | </xslo:variable>
|
---|
17 | <xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-nodes"
|
---|
18 | select="exsl:node-set($profiled-content)"/>
|
---|
19 | <xsl:choose>
|
---|
20 | <xsl:when test="namespace-uri(*[1]) = 'http://docbook.org/docbook-ng'">
|
---|
21 | <xsl:variable name="nons">
|
---|
22 | <xsl:apply-templates select="$profiled-nodes" mode="stripNS"/>
|
---|
23 | </xsl:variable>
|
---|
24 | <xsl:apply-templates select="exsl:node-set($nons)"/>
|
---|
25 | </xsl:when>
|
---|
26 | <xsl:otherwise>
|
---|
27 | <xsl:choose>
|
---|
28 | <xsl:when test="$rootid != ''">
|
---|
29 | <xsl:choose>
|
---|
30 | <xsl:when test="count($profiled-nodes//*[@id=$rootid]) = 0">
|
---|
31 | <xsl:message terminate="yes">
|
---|
32 | <xsl:text>ID '</xsl:text>
|
---|
33 | <xsl:value-of select="$rootid"/>
|
---|
34 | <xsl:text>' not found in document.</xsl:text>
|
---|
35 | </xsl:message>
|
---|
36 | </xsl:when>
|
---|
37 | <xsl:otherwise>
|
---|
38 | <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
|
---|
39 | <xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
|
---|
40 | </xsl:if>
|
---|
41 | <xsl:if test="$collect.xref.targets != 'only'">
|
---|
42 | <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid]" mode="process.root"/>
|
---|
43 | <xsl:if test="$tex.math.in.alt != ''">
|
---|
44 | <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid]" mode="collect.tex.math"/>
|
---|
45 | </xsl:if>
|
---|
46 | <xsl:if test="$generate.manifest != 0">
|
---|
47 | <xsl:call-template name="generate.manifest">
|
---|
48 | <xsl:with-param name="node" select="key('id',$rootid)"/>
|
---|
49 | </xsl:call-template>
|
---|
50 | </xsl:if>
|
---|
51 | </xsl:if>
|
---|
52 | </xsl:otherwise>
|
---|
53 | </xsl:choose>
|
---|
54 | </xsl:when>
|
---|
55 | <xsl:otherwise>
|
---|
56 | <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
|
---|
57 | <xsl:apply-templates select="$profiled-nodes" mode="collect.targets"/>
|
---|
58 | </xsl:if>
|
---|
59 | <xsl:if test="$collect.xref.targets != 'only'">
|
---|
60 | <xsl:apply-templates select="$profiled-nodes" mode="process.root"/>
|
---|
61 | <xsl:if test="$tex.math.in.alt != ''">
|
---|
62 | <xsl:apply-templates select="$profiled-nodes" mode="collect.tex.math"/>
|
---|
63 | </xsl:if>
|
---|
64 | <xsl:if test="$generate.manifest != 0">
|
---|
65 | <xsl:call-template name="generate.manifest"/>
|
---|
66 | </xsl:if>
|
---|
67 | </xsl:if>
|
---|
68 | </xsl:otherwise>
|
---|
69 | </xsl:choose>
|
---|
70 | </xsl:otherwise>
|
---|
71 | </xsl:choose>
|
---|
72 | </xsl:template>
|
---|
73 |
|
---|
74 | <xsl:template match="*" mode="stripNS">
|
---|
75 | <xsl:choose>
|
---|
76 | <xsl:when test="namespace-uri(.) = 'http://docbook.org/docbook-ng'">
|
---|
77 | <xsl:element name="{local-name(.)}">
|
---|
78 | <xsl:copy-of select="@*"/>
|
---|
79 | <xsl:apply-templates mode="stripNS"/>
|
---|
80 | </xsl:element>
|
---|
81 | </xsl:when>
|
---|
82 | <xsl:otherwise>
|
---|
83 | <xsl:copy>
|
---|
84 | <xsl:copy-of select="@*"/>
|
---|
85 | <xsl:apply-templates mode="stripNS"/>
|
---|
86 | </xsl:copy>
|
---|
87 | </xsl:otherwise>
|
---|
88 | </xsl:choose>
|
---|
89 | </xsl:template>
|
---|
90 |
|
---|
91 | </xsl:stylesheet>
|
---|
92 |
|
---|