summaryrefslogtreecommitdiffstats
path: root/doc/xsldbg/xsldbghelp.xsl
blob: c1587726a4010045feaeae2ce8f711e25747fa21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?xml version="1.0" encoding="UTF-8" ?>
<!-- 
     File : xsldoc.xsl     
     Author: Keith Isdale <[email protected]>
     Description: Stylesheet to process xsldoc.xml and generate help text
     Copyright Reserved Under GPL     
-->
<!-- This file does not require translation -->
<!-- NO TRANSLATION -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">
  <xsl:output method="text"/>
  <xsl:strip-space elements="text"/>
  <!-- The selected nodes to be printed for overview -->
  <xsl:variable name="overview_node" select="//chapter[@id='introduction']"/>
  <!-- The selected nodes to be printed for usage overview -->
  <xsl:variable name="usage_node" select="//chapter[@id='using-xsldbg']"/>
  <!-- The list of valid xsldbg commands -->
  <xsl:variable name="command_nodes" select="//chapter[@id='commands']"/>
  <!-- The list of i18n paras -->
  <xsl:variable name="i18n_para" select="//i18n"/>
  <!-- What version is this document-->
  <xsl:variable name="doc_version" select="'3.3.0-1'"/>
  <!-- The default version of xsldbg -->
  <xsl:param name="xsldbg_version" select="'3.3.0'"/>
  <!-- We want 'help' to point to a invalid command if stylesheet
       user has not provided a value for 'help' param-->
  <xsl:param name="help" select="'_#_'"/>
  <xsl:variable name="help_id" select="concat($help,'_cmd')"/>
  <!-- Do we printout all documentation '1' if so '0' otherwise -->
  <xsl:param name="alldocs" select="0"/>
  <!-- The documentation we can find for 'help' user requires -->
  <xsl:variable name="help_cmd" select="$command_nodes/sect1[@id=$help_id or @shortcut=$help_id]"/>

  <!-- Our translatables -->
  <xsl:param name="xsldbgVerTxt" select="'xsldbg version'"/>
  <xsl:param name="helpDocVerTxt" select="'Help document version'"/>
  <xsl:param name="helpErrorTxt" select="'Help not found for command'"/>



  <!-- Main template-->
  <xsl:template match="/">
<xsl:text>         </xsl:text><xsl:value-of select="$xsldbgVerTxt"/><xsl:text> </xsl:text><xsl:value-of select="$xsldbg_version"/>
<xsl:text> 
</xsl:text>   
<xsl:text>         ====================</xsl:text><xsl:text> 
</xsl:text>  
    <xsl:choose>
    <xsl:when test="count($help_cmd) > 0" >
      <xsl:apply-templates select="$help_cmd" />
      <xsl:value-of select="$helpDocVerTxt"/><xsl:text> </xsl:text><xsl:value-of select="$doc_version"/><xsl:text> 
</xsl:text> 
      </xsl:when>
    <xsl:otherwise>
        <xsl:if test="$help !='_#_'">
	  <xsl:value-of select="$helpErrorTxt"/><xsl:text> </xsl:text>  
          <xsl:value-of select="$help"/>
	</xsl:if>
        <xsl:if test="$help ='_#_'">
	    <xsl:apply-templates select="$overview_node"/>
	    <xsl:text>
</xsl:text>
	    <xsl:apply-templates select="$usage_node"/>
	    <xsl:value-of select="$helpDocVerTxt"/><xsl:text> </xsl:text><xsl:value-of select="$doc_version"/><xsl:text> 
</xsl:text> 
	</xsl:if>
<xsl:text> 
</xsl:text>   
   </xsl:otherwise>
  </xsl:choose>
<xsl:text> 
</xsl:text> 
  </xsl:template>


   <!-- Convert title into something useful -->
  <xsl:template match="title">
<xsl:for-each select="ancestor::node()"><xsl:text>  </xsl:text></xsl:for-each><xsl:value-of select="."/>
<xsl:text> 
</xsl:text><xsl:for-each select="ancestor::node()"><xsl:text>  </xsl:text></xsl:for-each>
<xsl:value-of
  select="substring('____________________________________________________________',
  1, string-length())" />
<xsl:text> 
</xsl:text>
  </xsl:template>

  <xsl:template match="text()">
    <xsl:value-of select="normalize-space()"/>
  </xsl:template>

  <xsl:template match="row">
    <xsl:value-of select="$indentgroup/indent[@level=$indentcount]" />
    <xsl:apply-templates/>
  </xsl:template>
  
  <xsl:template match="para">
    <xsl:text> 
</xsl:text>
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="informaltable|table">
    <xsl:text>
</xsl:text>
    <xsl:apply-templates select="title"/>
    <xsl:for-each select="tgroup/tbody/row/entry|tbody/row/entry">
      <xsl:for-each select="ancestor::node()"><xsl:text>  </xsl:text></xsl:for-each><xsl:apply-templates/>
      <xsl:text>
</xsl:text>
    </xsl:for-each>
  </xsl:template>

</xsl:stylesheet>