| 1 | <?xml version='1.0'?>
|
|---|
| 2 | <!--
|
|---|
| 3 | Extract examples out of a DocBook/XML file into separate files.
|
|---|
| 4 | (C) Jelmer Vernooij 2003
|
|---|
| 5 |
|
|---|
| 6 | Published under the GNU GPLv3 or later
|
|---|
| 7 | -->
|
|---|
| 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"
|
|---|
| 11 | version="1.1"
|
|---|
| 12 | extension-element-prefixes="exsl">
|
|---|
| 13 |
|
|---|
| 14 | <xsl:output method="xml"/>
|
|---|
| 15 |
|
|---|
| 16 | <xsl:template match="example/title"></xsl:template>
|
|---|
| 17 |
|
|---|
| 18 | <xsl:template match="example/simplelist/title"></xsl:template>
|
|---|
| 19 |
|
|---|
| 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.
|
|---|
| 24 | -->
|
|---|
| 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.
|
|---|
| 28 | -->
|
|---|
| 29 | <xsl:variable name="content">
|
|---|
| 30 | <xsl:apply-templates/>
|
|---|
| 31 | </xsl:variable>
|
|---|
| 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 :) -->
|
|---|
| 35 | <xsl:message>
|
|---|
| 36 | <xsl:text>Writing </xsl:text>
|
|---|
| 37 | <xsl:value-of select="$filename"/>
|
|---|
| 38 | <xsl:text> for </xsl:text>
|
|---|
| 39 | <xsl:value-of select="title"/>
|
|---|
| 40 | </xsl:message>
|
|---|
| 41 | <!-- Write finally varlistentry to a separate file -->
|
|---|
| 42 | <exsl:document href="{$filename}"
|
|---|
| 43 | method="xml"
|
|---|
| 44 | encoding="UTF-8"
|
|---|
| 45 | indent="yes"
|
|---|
| 46 | omit-xml-declaration="yes">
|
|---|
| 47 | <xsl:copy-of select="$content"/>
|
|---|
| 48 | </exsl:document>
|
|---|
| 49 | </xsl:template>
|
|---|
| 50 |
|
|---|
| 51 | </xsl:stylesheet>
|
|---|