summaryrefslogtreecommitdiff
path: root/docs-xml/xslt/extract-examples.xsl
diff options
context:
space:
mode:
authorGerald W. Carter <jerry@samba.org>2008-04-22 10:09:40 -0500
committerGerald W. Carter <jerry@samba.org>2008-04-23 08:47:48 -0500
commit8f8a9f01909ba29e2b781310baeeaaddc3f15f0d (patch)
tree90c6b720ad3a7bc815245c0ef28820424f89d658 /docs-xml/xslt/extract-examples.xsl
parent197238246389c40edc60c6630d18d6913086e630 (diff)
downloadsamba-8f8a9f01909ba29e2b781310baeeaaddc3f15f0d.tar.gz
samba-8f8a9f01909ba29e2b781310baeeaaddc3f15f0d.tar.bz2
samba-8f8a9f01909ba29e2b781310baeeaaddc3f15f0d.zip
Moving docs tree to docs-xml to make room for generated docs in the release tarball.
(This used to be commit 9f672c26d63955f613088489c6efbdc08b5b2d14)
Diffstat (limited to 'docs-xml/xslt/extract-examples.xsl')
-rw-r--r--docs-xml/xslt/extract-examples.xsl50
1 files changed, 50 insertions, 0 deletions
diff --git a/docs-xml/xslt/extract-examples.xsl b/docs-xml/xslt/extract-examples.xsl
new file mode 100644
index 0000000000..fc90addecc
--- /dev/null
+++ b/docs-xml/xslt/extract-examples.xsl
@@ -0,0 +1,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>
+