Browse code

docbook: folder moved from root to doc

Daniel-Constantin Mierla authored on 07/12/2016 13:55:42
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,111 +0,0 @@
1
-<?xml version='1.0'?>
2
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
-				version='1.0' xmlns:xi="http://www.w3.org/2001/XInclude">
4
-	<xsl:param name="output"/>
5
-
6
-	<!-- Write the output into a plaintext file which will be later included
7
-		 into the Makefile -->
8
-	<xsl:template match="/">
9
-		<xsl:document href="{$output}" method="text" indent="no" 
10
-					  omit-xml-declaration="yes">
11
-			<xsl:value-of select="concat($output, ':$(wildcard  ')"/>
12
-			<xsl:apply-templates mode="subroot"/>
13
-			<xsl:text>)&#xA;</xsl:text>
14
-		</xsl:document>
15
-	</xsl:template>
16
-	
17
-	<!-- This template extract the name of the directory from a full pathname,
18
-	     in other words it returns everything but the name of the file -->
19
-	<xsl:template name="dirname">
20
-		<xsl:param name="filename"/>
21
-		<xsl:if test="contains($filename, '/')">
22
-			<xsl:value-of 
23
-				select="concat(substring-before($filename, '/'), '/')"/>
24
-			<xsl:call-template name="dirname">
25
-				<xsl:with-param name="filename" 
26
-								select="substring-after($filename, '/')"/>
27
-			</xsl:call-template>
28
-		</xsl:if>
29
-	</xsl:template>
30
-
31
-	<!-- This template is used to add a directory preefix to a filename. The
32
-	     prefix is only added if the filename is not absolute (i.e. it does
33
-	     not start with a / and if the prefix is not an empty string -->
34
-	<xsl:template name="addprefix">
35
-		<xsl:param name="prefix"/>
36
-		<xsl:param name="filename"/>
37
-		<xsl:if test="(string-length($prefix) > 0) and not(starts-with($filename, '/'))">
38
-			<xsl:value-of select="$prefix"/>
39
-		</xsl:if>
40
-		<xsl:value-of select="$filename"/>
41
-	</xsl:template>
42
-	
43
-	<!-- This template processes xi:include directives that include other XML
44
-	     documents. First the template outputs the name of the file being
45
-	     included and then the template traverses the included file
46
-	     recursively, searching fro other dependencies in that file.  The
47
-	     template passes the parameter prefix to other templates with its
48
-	     value set to the directory name of the file being included. This
49
-	     ensures that paths to all dependencies are relative to the main
50
-	     file. -->
51
-	<xsl:template match='xi:include' mode="subroot">
52
-		<xsl:param name="prefix"/>
53
-
54
-		<!-- Add the prefix to the name of the file being included and store
55
-		     the result in variable fullpath -->
56
-		<xsl:variable name="fullpath">
57
-			<xsl:call-template name="addprefix">
58
-				<xsl:with-param name="prefix" select="$prefix"/>
59
-				<xsl:with-param name="filename" select="@href"/>
60
-			</xsl:call-template>
61
-		</xsl:variable>
62
-
63
-		<!-- First of all, output the name of the file being included, with
64
-		     proper prefix so that the resulting dependency is relative to the
65
-		     top-most file being processed, not the file we are are processing
66
-		     in this step. -->
67
-		<xsl:value-of select="concat($fullpath, ' ')"/>
68
-
69
-		<!-- Traverse the file being included and search for more depencencies
70
-		     in that file and other files included from there. -->
71
-		<xsl:apply-templates select="document(@href)" mode="subroot">
72
-			<!-- Extract the directory name from $fullpath and set it as a new
73
-			     value of the prefix parameter before calling other templates.
74
-			-->
75
-			<xsl:with-param name="prefix">
76
-				<xsl:call-template name="dirname">
77
-					<xsl:with-param name="filename" select="$fullpath"/>
78
-				</xsl:call-template>
79
-			</xsl:with-param>
80
-
81
-			<!-- Process the included file recursively -->
82
-		</xsl:apply-templates>
83
-	</xsl:template>
84
-	
85
-	<!-- This template processes files included with xi:include that are not
86
-	     XML files, such files will only be output as dependencies and will be
87
-	     not traversed recursively. -->
88
-	<xsl:template match='xi:include[@parse="text"]' mode="subroot">
89
-		<xsl:param name="prefix"/>
90
-		<xsl:call-template name="addprefix">
91
-			<xsl:with-param name="prefix" select="$prefix"/>
92
-			<xsl:with-param name="filename" select="@href"/>
93
-		</xsl:call-template>
94
-		<xsl:text> </xsl:text>
95
-	</xsl:template>
96
-	
97
-	<!-- This template processes mediaobjects (such as images) included in
98
-	     docbook. -->
99
-	<xsl:template match="graphic|imagedata|inlinemediaobject|textdata" 
100
-				  mode="subroot">
101
-		<xsl:param name="prefix"/>
102
-		<xsl:call-template name="addprefix">
103
-			<xsl:with-param name="prefix" select="$prefix"/>
104
-			<xsl:with-param name="filename" select="@fileref"/>
105
-		</xsl:call-template>
106
-		<xsl:text> </xsl:text>
107
-	</xsl:template>
108
-	
109
-	<!-- Supress all other output -->
110
-	<xsl:template match="text()|@*" mode="subroot"/>
111
-</xsl:stylesheet>
Browse code

docbook: fix rm'ed files mentioned in .d build error

When some .xml include file is deleted or removed, but the .d
already exists, the build will fail trying to build the apparently
missing file, requiring a make proper.
This fix enclosed the prerequisites in $(wildcard ...), when
generating the .d file.

Andrei Pelinescu-Onciul authored on 10/03/2010 09:42:15
Showing 1 changed files
... ...
@@ -8,8 +8,9 @@
8 8
 	<xsl:template match="/">
9 9
 		<xsl:document href="{$output}" method="text" indent="no" 
10 10
 					  omit-xml-declaration="yes">
11
-			<xsl:value-of select="concat($output, ': ')"/>
11
+			<xsl:value-of select="concat($output, ':$(wildcard  ')"/>
12 12
 			<xsl:apply-templates mode="subroot"/>
13
+			<xsl:text>)&#xA;</xsl:text>
13 14
 		</xsl:document>
14 15
 	</xsl:template>
15 16
 	
Browse code

docbook: Fixed docbook dependency generator

Previous version of the XSL stylesheet that is used to generate dependencies
for docbook documents did not work properly with docbook files included from
other directories, it did not make dependencies relative to the top-level
file being processed, resulting in dependency files that cannot be satisfied.

This change fixes the stylesheet and makes all the depedendencies generated
by the stylesheet relative to the directory of the top-level docbook document
being processed.

In addition to that it fixes a small typo in the main docbook Makefile.

Jan Janak authored on 13/05/2009 20:11:18
Showing 1 changed files
... ...
@@ -1,10 +1,10 @@
1 1
 <?xml version='1.0'?>
2 2
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 3
 				version='1.0' xmlns:xi="http://www.w3.org/2001/XInclude">
4
-	
5
-	<xsl:param name="prefix"/>
6 4
 	<xsl:param name="output"/>
7
-	
5
+
6
+	<!-- Write the output into a plaintext file which will be later included
7
+		 into the Makefile -->
8 8
 	<xsl:template match="/">
9 9
 		<xsl:document href="{$output}" method="text" indent="no" 
10 10
 					  omit-xml-declaration="yes">
... ...
@@ -13,36 +13,98 @@
13 13
 		</xsl:document>
14 14
 	</xsl:template>
15 15
 	
16
-	<xsl:template name="get-prefix">
17
-		<xsl:if test="contains($prefix, '/')">
18
-			<xsl:value-of select="concat(substring-before($prefix, '/'), '/')"/>
19
-			<xsl:call-template name="get-prefix">
20
-				<xsl:with-param name="prefix" 
21
-								select="substring-after($prefix, '/')"/>
16
+	<!-- This template extract the name of the directory from a full pathname,
17
+	     in other words it returns everything but the name of the file -->
18
+	<xsl:template name="dirname">
19
+		<xsl:param name="filename"/>
20
+		<xsl:if test="contains($filename, '/')">
21
+			<xsl:value-of 
22
+				select="concat(substring-before($filename, '/'), '/')"/>
23
+			<xsl:call-template name="dirname">
24
+				<xsl:with-param name="filename" 
25
+								select="substring-after($filename, '/')"/>
22 26
 			</xsl:call-template>
23 27
 		</xsl:if>
24 28
 	</xsl:template>
29
+
30
+	<!-- This template is used to add a directory preefix to a filename. The
31
+	     prefix is only added if the filename is not absolute (i.e. it does
32
+	     not start with a / and if the prefix is not an empty string -->
33
+	<xsl:template name="addprefix">
34
+		<xsl:param name="prefix"/>
35
+		<xsl:param name="filename"/>
36
+		<xsl:if test="(string-length($prefix) > 0) and not(starts-with($filename, '/'))">
37
+			<xsl:value-of select="$prefix"/>
38
+		</xsl:if>
39
+		<xsl:value-of select="$filename"/>
40
+	</xsl:template>
25 41
 	
42
+	<!-- This template processes xi:include directives that include other XML
43
+	     documents. First the template outputs the name of the file being
44
+	     included and then the template traverses the included file
45
+	     recursively, searching fro other dependencies in that file.  The
46
+	     template passes the parameter prefix to other templates with its
47
+	     value set to the directory name of the file being included. This
48
+	     ensures that paths to all dependencies are relative to the main
49
+	     file. -->
26 50
 	<xsl:template match='xi:include' mode="subroot">
27
-		<xsl:value-of select="concat($prefix, concat(@href, ' '))"/>
51
+		<xsl:param name="prefix"/>
52
+
53
+		<!-- Add the prefix to the name of the file being included and store
54
+		     the result in variable fullpath -->
55
+		<xsl:variable name="fullpath">
56
+			<xsl:call-template name="addprefix">
57
+				<xsl:with-param name="prefix" select="$prefix"/>
58
+				<xsl:with-param name="filename" select="@href"/>
59
+			</xsl:call-template>
60
+		</xsl:variable>
61
+
62
+		<!-- First of all, output the name of the file being included, with
63
+		     proper prefix so that the resulting dependency is relative to the
64
+		     top-most file being processed, not the file we are are processing
65
+		     in this step. -->
66
+		<xsl:value-of select="concat($fullpath, ' ')"/>
67
+
68
+		<!-- Traverse the file being included and search for more depencencies
69
+		     in that file and other files included from there. -->
28 70
 		<xsl:apply-templates select="document(@href)" mode="subroot">
71
+			<!-- Extract the directory name from $fullpath and set it as a new
72
+			     value of the prefix parameter before calling other templates.
73
+			-->
29 74
 			<xsl:with-param name="prefix">
30
-				<xsl:call-template name="get-prefix">
31
-					<xsl:with-param name="prefix" 
32
-									select="concat($prefix, @href)"/>
75
+				<xsl:call-template name="dirname">
76
+					<xsl:with-param name="filename" select="$fullpath"/>
33 77
 				</xsl:call-template>
34 78
 			</xsl:with-param>
79
+
80
+			<!-- Process the included file recursively -->
35 81
 		</xsl:apply-templates>
36 82
 	</xsl:template>
37 83
 	
84
+	<!-- This template processes files included with xi:include that are not
85
+	     XML files, such files will only be output as dependencies and will be
86
+	     not traversed recursively. -->
38 87
 	<xsl:template match='xi:include[@parse="text"]' mode="subroot">
39
-		<xsl:value-of select="concat($prefix, concat(@href, ' '))"/>
88
+		<xsl:param name="prefix"/>
89
+		<xsl:call-template name="addprefix">
90
+			<xsl:with-param name="prefix" select="$prefix"/>
91
+			<xsl:with-param name="filename" select="@href"/>
92
+		</xsl:call-template>
93
+		<xsl:text> </xsl:text>
40 94
 	</xsl:template>
41 95
 	
96
+	<!-- This template processes mediaobjects (such as images) included in
97
+	     docbook. -->
42 98
 	<xsl:template match="graphic|imagedata|inlinemediaobject|textdata" 
43 99
 				  mode="subroot">
44
-		<xsl:value-of select="concat($prefix, concat(@fileref, ' '))"/>
100
+		<xsl:param name="prefix"/>
101
+		<xsl:call-template name="addprefix">
102
+			<xsl:with-param name="prefix" select="$prefix"/>
103
+			<xsl:with-param name="filename" select="@fileref"/>
104
+		</xsl:call-template>
105
+		<xsl:text> </xsl:text>
45 106
 	</xsl:template>
46 107
 	
108
+	<!-- Supress all other output -->
47 109
 	<xsl:template match="text()|@*" mode="subroot"/>
48 110
 </xsl:stylesheet>
Browse code

New Docbook processing system.

This is the new and improved version of the docbook build system that
was present in ser and kamailio. It consists of Makefiles, xslt
stylesheets, css stylesheets, and other auxiliary files that are needed
to convert documentation stored in docbook xml format to various output
formats. We currently support the following outputs: HTML, plain-text,
and module README. Other formats (man pages, chunked HTML and possibly
PDF) will be added later.

First of all, we are moving all files that are part of the docbook
processing system into one directory "docbook". Those files were
previously scaterred across multiple directories in the repository and
having them all at one place make the system less error-prone.

We have merged files containing SGML entity definitions from both
projects into a single file. The file is stored in docbook/entities.xml
and this is the file that should be included by all docbook documents
(we will need to update all such files in all modules).

The Kamailio CSS style sheet for module documentation is now becoming
the main CSS stylesheet for HTML documentation generated from docbook
sources. The new stylesheet is stored in docbook/sr-doc.css. The
contents of the file was slighlty updated to make sure that the styles
in the file match HTML elements in XHTML output. With the new system
the default output HTML flavor is XHTML.

The toplevel Makefile.doc is gone. It is being replaced by file
docbook/Makefile. The new makefile has been extensively polished and
improved. This also requires new Makefiles in modules. All the targets
and references that were used to generate the PDF output in SER are
gone, we were using proprietary FOP processor which is not generally
available. All configuration options that can be overriden from
module/doc Makefiles are extensively commented. The new Makefile can
save the output being generated into a directory specified on the
command line:
$ output_dir=/html make html
The default target of the Makefile is HTML. There is a new target that
can be used generate module README:
$ make readme

The file that should be included from module Makefiles is
docbook/Makefile.modules. At present the file only includes the main
Makefile, but in the future some of the targets that are particular
to module documentation will be moved to this file.

The XML catalog received a small facelift, too. By default the catalog
references /etc/xml/catalog. References to dbschema DTD and XSL files
(dbschema is the scripting system used to generate SQL files in SER)
are gone. They do not belong into this file.

All references to Drupal and drupal related xsl stylesheets are gone.
Those files were used to generate HTML files suitable for inclusion
into Drupal pages at iptel.org.

File doc/kam_module_faq.xml has also been removed, this file was empty,
it was probably added because it was included by far too many docbook
documents in modules. Since I wrote a script to do some compatibility
changes in module docbook files, I taught it to remove the reference
to the file from all docbook files and then deleted the file.

All files in directory "docbook" are briefly described in
docbook/README.

The new system adopted Kamailio costumizations of the docbook stylesheet
that is used to generate READMEs. There is a new stylesheet called
readme.xsl that contains all options that should only be applied when
READMEs are being generated.

The stylesheet that generates man pages from docbook has been moved
from doc/stylesheets to docbook/man.xsl. We do not have yet support for
man pages in the docbook Makefile, this feature will be added later.

New features:
* Automatic dependency calculation. We have a XSL stylesheet which
traverses the source docbook document and produces a list of files
included in the document. This list is then included in the main
Makefile to calculate dependencies. That means you can split your
document into multiple files and the system will always correctly
rebuild the file.

* Support for document inclusion with xi:include. All source docbook
files are processed with the support for xi:include enabled which
makes it possible to include other documents without the need to
use SGML entities to include external files.

* Improved top level make file, among other things the makefile is now
much more flexible, the module can specify different source document
for each type of produced output. The makefile can generate module
READMEs. The output directory is configurable, which is useful if you
need to build a collection of html pages to be uploaded to a server.

* Separate stylesheet to customize the format of module README files.

* Supported output formats:
README
XHTML (single file)
XHTML (multiple files)
Plain-text

* Normalized screens: There is no longer the need to pay attention to
the leading and trailing white space in data of <screen> (and similar)
elements. Stylesheet common.xsl contains a template that does that
automatically (this isn't really a new feature, is was present in
the original ser docbook processing system).

Jan Janak authored on 24/04/2009 00:13:45
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,48 @@
1
+<?xml version='1.0'?>
2
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
+				version='1.0' xmlns:xi="http://www.w3.org/2001/XInclude">
4
+	
5
+	<xsl:param name="prefix"/>
6
+	<xsl:param name="output"/>
7
+	
8
+	<xsl:template match="/">
9
+		<xsl:document href="{$output}" method="text" indent="no" 
10
+					  omit-xml-declaration="yes">
11
+			<xsl:value-of select="concat($output, ': ')"/>
12
+			<xsl:apply-templates mode="subroot"/>
13
+		</xsl:document>
14
+	</xsl:template>
15
+	
16
+	<xsl:template name="get-prefix">
17
+		<xsl:if test="contains($prefix, '/')">
18
+			<xsl:value-of select="concat(substring-before($prefix, '/'), '/')"/>
19
+			<xsl:call-template name="get-prefix">
20
+				<xsl:with-param name="prefix" 
21
+								select="substring-after($prefix, '/')"/>
22
+			</xsl:call-template>
23
+		</xsl:if>
24
+	</xsl:template>
25
+	
26
+	<xsl:template match='xi:include' mode="subroot">
27
+		<xsl:value-of select="concat($prefix, concat(@href, ' '))"/>
28
+		<xsl:apply-templates select="document(@href)" mode="subroot">
29
+			<xsl:with-param name="prefix">
30
+				<xsl:call-template name="get-prefix">
31
+					<xsl:with-param name="prefix" 
32
+									select="concat($prefix, @href)"/>
33
+				</xsl:call-template>
34
+			</xsl:with-param>
35
+		</xsl:apply-templates>
36
+	</xsl:template>
37
+	
38
+	<xsl:template match='xi:include[@parse="text"]' mode="subroot">
39
+		<xsl:value-of select="concat($prefix, concat(@href, ' '))"/>
40
+	</xsl:template>
41
+	
42
+	<xsl:template match="graphic|imagedata|inlinemediaobject|textdata" 
43
+				  mode="subroot">
44
+		<xsl:value-of select="concat($prefix, concat(@fileref, ' '))"/>
45
+	</xsl:template>
46
+	
47
+	<xsl:template match="text()|@*" mode="subroot"/>
48
+</xsl:stylesheet>