File: extract-examples.xsl

package info (click to toggle)
samba 2%3A3.2.5-4lenny15
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 124,704 kB
  • ctags: 69,181
  • sloc: ansic: 564,153; xml: 219,271; sh: 11,039; perl: 4,458; makefile: 4,301; python: 1,975; cpp: 1,224; exp: 1,147; yacc: 881; awk: 557; csh: 58; sed: 45
file content (50 lines) | stat: -rw-r--r-- 1,756 bytes parent folder | download
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
<?xml version='1.0'?>
<!--
Extract examples out of DocBook/XML file
	(C) Jelmer Vernooij	2003
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:exsl="http://exslt.org/common"
				xmlns:samba="http://www.samba.org/samba/DTD/samba-doc"
		version="1.1"
                extension-element-prefixes="exsl">

<xsl:output method="xml"/>

<xsl:template match="example/title"></xsl:template>

<xsl:template match="example/simplelist/title"></xsl:template>

<!-- Parse all varlistentries and extract those of them which are descriptions of smb.conf
     parameters. We determine them by existence of <anchor> element inside <term> element.
     If <anchor> is there, then its 'id' attribute is translated to lower case and is used
     as basis for file name for that parameter.
-->
<xsl:template match="example">
	<!-- reconstruct varlistentry - not all of them will go into separate files
	and also we must repair the main varlistentry itself.
	-->
	<xsl:variable name="content">
		<xsl:apply-templates/>
	</xsl:variable>
	<!-- Now put varlistentry into separate file _if_ it has anchor associated with it -->
	<xsl:variable name="filename"><xsl:text>examples/</xsl:text><xsl:value-of select="@id"/>.conf</xsl:variable>
	<!-- Debug message for an operator, just to show progress of processing :) -->
	<xsl:message>
		<xsl:text>Writing </xsl:text>
		<xsl:value-of select="$filename"/>
		<xsl:text> for </xsl:text>
		<xsl:value-of select="title"/>
	</xsl:message>
	<!-- Write finally varlistentry to a separate file -->
	<exsl:document href="{$filename}" 
		method="xml" 
		encoding="UTF-8" 
		indent="yes"
		omit-xml-declaration="yes">
		<xsl:copy-of select="$content"/>
	</exsl:document>
</xsl:template>

</xsl:stylesheet>