summaryrefslogtreecommitdiff
path: root/docs/docbook/smbdotconf/expand-smb.conf.xsl
blob: 62fc4a9ccf73c52123cd17380069bb825e5b319a (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
<?xml version='1.0'?>
<!-- vim:set sts=2 shiftwidth=2 syntax=xml: -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:exsl="http://exslt.org/common"
                xmlns:samba="http://samba.org/common"
		version="1.1"
                extension-element-prefixes="exsl">

<xsl:output method="xml"/>

<!-- Generates one big XML file for smb.conf -->

<xsl:param name="xmlSambaNsUri" select="'http://samba.org/common'"/>

<xsl:template match="refentry">
<xsl:text disable-output-escaping="yes">
&lt;!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
                  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [

&lt;!ENTITY % globalentities SYSTEM './../global.ent'> %globalentities;
]>
</xsl:text>
<xsl:element name="refentry">
	<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
	<xsl:apply-templates/>
</xsl:element>
</xsl:template>

<!-- This is needed to copy content unchanged -->
<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>


<xsl:template match="//samba:parameter">
  <!-- reconstruct varlistentry - not all of them will go into separate files
       and also we must repair the main varlistentry itself.
  -->
      <xsl:message>
        <xsl:text>Processing samba:parameter (</xsl:text>
        <xsl:value-of select="@name"/>
        <xsl:text>)</xsl:text>
      </xsl:message>

  <xsl:variable name="name"><xsl:value-of select="translate(translate(string(@name),' ',''),
                  'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
  </xsl:variable>
  
  <xsl:variable name="anchor">
     <xsl:element name="anchor">
        <xsl:attribute name="id">
          <xsl:value-of select="$name"/>
        </xsl:attribute>
     </xsl:element>
  </xsl:variable>

  <xsl:variable name="context">
     <xsl:text> (</xsl:text>
     <xsl:value-of select="@context"/>
     <xsl:text>)</xsl:text>
  </xsl:variable>

  <xsl:variable name="term">
     <xsl:element name="term">
          <xsl:copy-of select="$anchor"/>
          <xsl:value-of select="@name"/>
          <xsl:value-of select="$context"/>
     </xsl:element>
  </xsl:variable>

  <xsl:variable name="content">
       <xsl:apply-templates/>
  </xsl:variable>
  
  <xsl:element name="varlistentry">
     <xsl:text>&#10;</xsl:text>     
     <xsl:copy-of select="$term"/>
     <xsl:copy-of select="$content"/>
     <xsl:text>
</xsl:text>     
  </xsl:element>

</xsl:template>

</xsl:stylesheet>