1<?xml version="1.0"?> 2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 3 xmlns:m="http://www.w3.org/1998/Math/MathML" 4 version="1.0"> 5 6<xsl:output encoding="UTF-8" indent="yes"/> 7 8<!-- This stylesheet builds a refentry XML file for each parameter listed in 9 the passed <informaltable>. This translation should be done only once 10 to migrate from manual v0.2.9 to manual v0.2.10 where each parameter is 11 described like the DocBook Project does, i.e. through refentries. 12 13 The default parameter reference tree is like this: 14 ./ : where to store the refentry XML files built by this stylesheet 15 ./syn : where to store the synopsis XML files built by another XSLT 16 17 Example of use in the tools/ dir to put param refentries in tools/params/: 18 19 xsltproc -+-stringparam ref.prefix params/ \ 20 param2ref.xsl ../docs/custom/param.xml 21--> 22 23<xsl:param name="ref.prefix"></xsl:param> 24<xsl:param name="syn.prefix">syn/</xsl:param> 25<xsl:param name="syn.suffix">xml</xsl:param> 26 27<xsl:include href="../xsl/chunker.xsl"/> 28 29<xsl:template match="/"> 30 <xsl:apply-templates select="//informaltable"/> 31</xsl:template> 32 33<xsl:template match="informaltable"> 34 <xsl:apply-templates select="//tbody/row"/> 35</xsl:template> 36 37<xsl:template match="row"> 38 <xsl:variable name="param-name" select="entry[1]/text()"/> 39 40 <xsl:variable name="refentry"> 41 <refentry id="{$param-name}"> 42 <refmeta> 43 <refentrytitle> 44 <xsl:value-of select="$param-name"/> 45 </refentrytitle> 46 <!-- don't know what to do with this 47 <refmiscinfo class="other" otherclass="datatype">boolean</refmiscinfo> 48 --> 49 </refmeta> 50 <refnamediv> 51 <refname><xsl:value-of select="$param-name"/></refname> 52 <refpurpose>???</refpurpose> 53 </refnamediv> 54 55 <refsynopsisdiv> 56 <programlisting> 57 <!-- Point to the actual param synopsis --> 58 <xsl:element name="xi:include" 59 namespace="http://www.w3.org/2001/XInclude"> 60 <xsl:attribute name="parse">text</xsl:attribute> 61 <xsl:attribute name="href"> 62 <xsl:value-of select="concat($syn.prefix, $param-name, '.', 63 $syn.suffix)"/> 64 </xsl:attribute> 65 </xsl:element></programlisting> 66 </refsynopsisdiv> 67 68 <refsection><title>Description</title> 69 <para> 70 <xsl:apply-templates select="entry[2]/node()" mode="copy"/> 71 </para> 72 </refsection> 73 </refentry> 74 </xsl:variable> 75 76 <xsl:call-template name="write.chunk"> 77 <xsl:with-param name="filename"> 78 <xsl:value-of select="$ref.prefix"/> 79 <xsl:value-of select="$param-name"/> 80 <xsl:text>.xml</xsl:text> 81 </xsl:with-param> 82 <xsl:with-param name="method" select="'xml'"/> 83 <xsl:with-param name="doctype-public" 84 select="'-//OASIS//DTD DocBook XML V4.4//EN'"/> 85 <xsl:with-param name="doctype-system" 86 select="'http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd'"/> 87 <xsl:with-param name="encoding" select="$chunker.output.encoding"/> 88 <xsl:with-param name="content" select="$refentry"/> 89 <xsl:with-param name="indent" select="'yes'"/> 90 </xsl:call-template> 91 92</xsl:template> 93 94<xsl:template match="*" mode="copy"> 95 <xsl:copy-of select="."/> 96</xsl:template> 97 98 99</xsl:stylesheet> 100