3 Extract examples out of a DocBook/XML file into separate files.
4 (C) Jelmer Vernooij 2003
6 Published under the GNU GPLv3 or later
8 <xsl:stylesheet xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
9 xmlns:
exsl=
"http://exslt.org/common"
10 xmlns:
samba=
"http://www.samba.org/samba/DTD/samba-doc"
12 extension-element-prefixes=
"exsl">
14 <xsl:output method=
"xml"/>
16 <xsl:template match=
"example/title"></xsl:template>
18 <xsl:template match=
"example/simplelist/title"></xsl:template>
20 <!-- Parse all varlistentries and extract those of them which are descriptions of smb.conf
21 parameters. We determine them by existence of <anchor> element inside <term> element.
22 If <anchor> is there, then its 'id' attribute is translated to lower case and is used
23 as basis for file name for that parameter.
25 <xsl:template match=
"example">
26 <!-- reconstruct varlistentry - not all of them will go into separate files
27 and also we must repair the main varlistentry itself.
29 <xsl:variable name=
"content">
30 <xsl:apply-templates/>
32 <!-- Now put varlistentry into separate file _if_ it has anchor associated with it -->
33 <xsl:variable name=
"filename"><xsl:text>examples/
</xsl:text><xsl:value-of select=
"@id"/>.conf
</xsl:variable>
34 <!-- Debug message for an operator, just to show progress of processing :) -->
36 <xsl:text>Writing
</xsl:text>
37 <xsl:value-of select=
"$filename"/>
38 <xsl:text> for
</xsl:text>
39 <xsl:value-of select=
"title"/>
41 <!-- Write finally varlistentry to a separate file -->
42 <exsl:document href=
"{$filename}"
46 omit-xml-declaration=
"yes">
47 <xsl:copy-of select=
"$content"/>