2007-01-23 11:52:51 +01:00
|
|
|
|
<?xml version="1.0"?>
|
|
|
|
|
|
|
|
|
|
<xsl:stylesheet version="1.0"
|
|
|
|
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
|
|
|
xmlns:str="http://exslt.org/strings"
|
2007-01-23 12:06:31 +01:00
|
|
|
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
2007-01-23 11:52:51 +01:00
|
|
|
|
xmlns="http://docbook.org/ns/docbook"
|
|
|
|
|
extension-element-prefixes="str"
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
<xsl:output method='xml' encoding="UTF-8" />
|
|
|
|
|
|
2009-10-06 01:47:50 +02:00
|
|
|
|
<xsl:param name="revision" />
|
|
|
|
|
|
2007-01-23 12:39:02 +01:00
|
|
|
|
|
2007-01-23 11:52:51 +01:00
|
|
|
|
<xsl:template match="/expr/list">
|
|
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
|
|
|
|
|
|
<xsl:for-each select="attrs">
|
|
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
|
<term>
|
|
|
|
|
<option>
|
2007-11-11 11:46:26 +01:00
|
|
|
|
<xsl:for-each select="attr[@name = 'name']/string">
|
2007-01-23 11:52:51 +01:00
|
|
|
|
<xsl:value-of select="@value" />
|
2007-11-11 11:46:26 +01:00
|
|
|
|
<xsl:if test="position() != last()">.</xsl:if>
|
2007-01-23 11:52:51 +01:00
|
|
|
|
</xsl:for-each>
|
|
|
|
|
</option>
|
|
|
|
|
</term>
|
|
|
|
|
|
2007-01-23 12:39:02 +01:00
|
|
|
|
<listitem>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
<xsl:value-of disable-output-escaping="yes"
|
|
|
|
|
select="attr[@name = 'description']/string/@value" />
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
<emphasis>Default:</emphasis>
|
2009-07-14 17:47:03 +02:00
|
|
|
|
<xsl:text> </xsl:text>
|
2007-01-23 12:39:02 +01:00
|
|
|
|
<xsl:choose>
|
|
|
|
|
<xsl:when test="attr[@name = 'default']">
|
|
|
|
|
<literal>
|
|
|
|
|
<xsl:apply-templates select="attr[@name = 'default']" />
|
|
|
|
|
</literal>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:otherwise>
|
|
|
|
|
none
|
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<xsl:if test="attr[@name = 'example']">
|
2011-09-05 12:14:42 +02:00
|
|
|
|
|
2007-01-23 12:39:02 +01:00
|
|
|
|
<para>
|
|
|
|
|
<emphasis>Example:</emphasis>
|
2009-07-14 17:47:03 +02:00
|
|
|
|
<xsl:text> </xsl:text>
|
2011-09-05 12:14:42 +02:00
|
|
|
|
<xsl:choose>
|
|
|
|
|
<xsl:when test="attr[@name = 'example']/attrs[attr[@name = '_type' and string[@value = 'literalExample']]]">
|
|
|
|
|
<programlisting><xsl:value-of select="attr[@name = 'example']/attrs/attr[@name = 'text']/string/@value" /></programlisting>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:otherwise>
|
|
|
|
|
<literal>
|
|
|
|
|
<xsl:apply-templates select="attr[@name = 'example']" />
|
|
|
|
|
</literal>
|
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
2007-01-23 12:39:02 +01:00
|
|
|
|
</para>
|
|
|
|
|
</xsl:if>
|
2009-09-18 17:10:32 +02:00
|
|
|
|
|
|
|
|
|
<xsl:if test="count(attr[@name = 'declarations']/list/*) != 0">
|
|
|
|
|
<para>
|
|
|
|
|
<emphasis>Declared by:</emphasis>
|
|
|
|
|
</para>
|
2009-10-06 01:15:06 +02:00
|
|
|
|
<xsl:apply-templates select="attr[@name = 'declarations']" />
|
2009-09-18 17:10:32 +02:00
|
|
|
|
</xsl:if>
|
|
|
|
|
|
|
|
|
|
<xsl:if test="count(attr[@name = 'definitions']/list/*) != 0">
|
|
|
|
|
<para>
|
|
|
|
|
<emphasis>Defined by:</emphasis>
|
|
|
|
|
</para>
|
2009-10-06 01:15:06 +02:00
|
|
|
|
<xsl:apply-templates select="attr[@name = 'definitions']" />
|
2009-09-18 17:10:32 +02:00
|
|
|
|
</xsl:if>
|
2007-01-23 12:39:02 +01:00
|
|
|
|
|
|
|
|
|
</listitem>
|
2007-01-23 11:52:51 +01:00
|
|
|
|
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
|
|
</xsl:for-each>
|
|
|
|
|
|
|
|
|
|
</variablelist>
|
|
|
|
|
|
|
|
|
|
</xsl:template>
|
2007-01-23 12:39:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<xsl:template match="string">
|
|
|
|
|
<!-- !!! escaping -->
|
2009-07-15 15:40:30 +02:00
|
|
|
|
<xsl:text>"</xsl:text><xsl:value-of select="str:replace(str:replace(str:replace(@value, '\', '\\'), '"', '\"'), '
', '\n')" /><xsl:text>"</xsl:text>
|
2007-01-23 12:39:02 +01:00
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<xsl:template match="int">
|
|
|
|
|
<xsl:value-of select="@value" />
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<xsl:template match="bool[@value = 'true']">
|
2007-11-21 15:39:52 +01:00
|
|
|
|
<xsl:text>true</xsl:text>
|
2007-01-23 12:39:02 +01:00
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<xsl:template match="bool[@value = 'false']">
|
2007-11-21 15:39:52 +01:00
|
|
|
|
<xsl:text>false</xsl:text>
|
2007-01-23 12:39:02 +01:00
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<xsl:template match="list">
|
|
|
|
|
[
|
|
|
|
|
<xsl:for-each select="*">
|
|
|
|
|
<xsl:apply-templates select="." />
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
</xsl:for-each>
|
|
|
|
|
]
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<xsl:template match="attrs">
|
|
|
|
|
{
|
|
|
|
|
<xsl:for-each select="attr">
|
|
|
|
|
<xsl:value-of select="@name" />
|
|
|
|
|
<xsl:text> = </xsl:text>
|
2007-11-21 15:39:52 +01:00
|
|
|
|
<xsl:apply-templates select="*" /><xsl:text>; </xsl:text>
|
2007-01-23 12:39:02 +01:00
|
|
|
|
</xsl:for-each>
|
|
|
|
|
}
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<xsl:template match="derivation">
|
|
|
|
|
<xsl:choose>
|
|
|
|
|
<xsl:when test="attr[@name = 'url']/string/@value">
|
2009-10-06 01:15:06 +02:00
|
|
|
|
<replaceable>(download of <xsl:value-of select="attr[@name = 'url']/string/@value" />)</replaceable>
|
2007-01-23 12:39:02 +01:00
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:otherwise>
|
2009-10-06 01:15:06 +02:00
|
|
|
|
<replaceable>(build of <xsl:value-of select="attr[@name = 'name']/string/@value" />)</replaceable>
|
2007-01-23 12:39:02 +01:00
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
|
|
|
|
</xsl:template>
|
2009-09-18 17:10:37 +02:00
|
|
|
|
|
|
|
|
|
<xsl:template match="attr[@name = 'declarations' or @name = 'definitions']">
|
2009-10-06 01:15:06 +02:00
|
|
|
|
<simplelist>
|
2009-09-18 17:10:37 +02:00
|
|
|
|
<xsl:for-each select="list/string">
|
2009-10-06 01:47:50 +02:00
|
|
|
|
<member><filename>
|
|
|
|
|
<!-- Hyperlink the filename either to the NixOS Subversion
|
|
|
|
|
repository (if it’s a module and we have a revision number),
|
|
|
|
|
or to the local filesystem. -->
|
|
|
|
|
<xsl:choose>
|
|
|
|
|
<xsl:when test="$revision != 'local' and contains(@value, '/modules/')">
|
|
|
|
|
<xsl:attribute name="xlink:href">https://svn.nixos.org/viewvc/nix/nixos/trunk/modules/<xsl:value-of select="substring-after(@value, '/modules/')"/>?revision=<xsl:value-of select="$revision"/></xsl:attribute>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:otherwise>
|
|
|
|
|
<xsl:attribute name="xlink:href">file://<xsl:value-of select="@value"/></xsl:attribute>
|
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
2009-10-06 21:07:09 +02:00
|
|
|
|
<!-- Print the filename and make it user-friendly by replacing the
|
|
|
|
|
/nix/store/<hash> prefix by the default location of nixos
|
|
|
|
|
sources. -->
|
2009-10-06 11:53:19 +02:00
|
|
|
|
<xsl:choose>
|
2009-10-06 11:58:11 +02:00
|
|
|
|
<xsl:when test="starts-with(@value, '/nix/store/')">
|
2009-10-06 21:07:09 +02:00
|
|
|
|
/etc/nixos/nixos/modules/<xsl:value-of select="substring-after(@value, '/modules/')"/>
|
2009-10-06 11:53:19 +02:00
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:otherwise>
|
|
|
|
|
<xsl:value-of select="@value" />
|
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
2009-10-06 01:47:50 +02:00
|
|
|
|
</filename></member>
|
2009-09-18 17:10:37 +02:00
|
|
|
|
</xsl:for-each>
|
2009-10-06 01:15:06 +02:00
|
|
|
|
</simplelist>
|
2009-09-18 17:10:37 +02:00
|
|
|
|
</xsl:template>
|
2007-01-23 11:52:51 +01:00
|
|
|
|
|
|
|
|
|
</xsl:stylesheet>
|