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