<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output method="html" encoding="windows-1252" indent="yes"/>

<xsl:template match="/">
  <html>
    <head>
        <link rel="stylesheet" type="text/css" href="../appl/api2/reference.css?"/>
        <title>API <xsl:value-of select="/api/records_name"/></title>
    </head>
    <body>
        <header>
            <h1>Facilitor&#174; API reference: <xsl:value-of select="/api/records_name"/></h1>
            <xsl:if test="/api/records_title!=''">
                <p><xsl:value-of select="/api/records_title"/></p>
            </xsl:if>
        </header>
        <xsl:if test="/api/autfunction!=''">
            Autorisation: <xsl:value-of select="/api/autfunction"/> (<xsl:value-of select="/api/autfunctionname"/>)<br/>
        </xsl:if>
        Record name: <xsl:value-of select="/api/record_name"/><br />
        Records name: <xsl:value-of select="/api/records_name"/><br />
        <h2>Parameters:</h2>
        <xsl:element name="ul">
            <xsl:element name="li">
                include
                <xsl:element name="ul">
                    <xsl:for-each select="/api/includes/*">
                        <xsl:element name="li">
                            <xsl:element name="a">
                                <xsl:attribute name="href">../api2/<xsl:value-of select="local-name()"/>.doc</xsl:attribute>
                				<xsl:value-of select="local-name()"/>
                            </xsl:element>
                        </xsl:element>
                    </xsl:for-each>
                </xsl:element>
            </xsl:element>
        </xsl:element>
        <h2>Example:</h2>
            <div class="sample">
            <xsl:element name="a">
                <xsl:attribute name="href">../api2/<xsl:value-of select="/api/records_name"/>.html?limit=3</xsl:attribute>
				<xsl:attribute name="target">_new</xsl:attribute>
				GET /api2/<xsl:value-of select="/api/records_name"/>.json
            </xsl:element>
            </div>
            <xsl:for-each select="/api/includes/*">
                <div class="sample">
                <xsl:element name="a">
                    <xsl:attribute name="href">../api2/<xsl:value-of select="/api/records_name"/>.html?include=<xsl:value-of select="local-name()"/>&amp;limit=3</xsl:attribute>
    				<xsl:attribute name="target">_new</xsl:attribute>
    				GET /api2/<xsl:value-of select="/api/records_name"/>.json?include=<xsl:value-of select="local-name()"/>
                </xsl:element>
                </div>
            </xsl:for-each>
            <div class="sample">
            <xsl:element name="a">
                <xsl:attribute name="href">../api2/<xsl:value-of select="/api/records_name"/>.xml?limit=3</xsl:attribute>
				<xsl:attribute name="target">_new</xsl:attribute>
				GET /api2/<xsl:value-of select="/api/records_name"/>.xml
            </xsl:element>
            </div>
            <div class="sample">
            <xsl:element name="a">
                <xsl:attribute name="href">../api2/<xsl:value-of select="/api/records_name"/>.table?limit=3</xsl:attribute>
				<xsl:attribute name="target">_new</xsl:attribute>
				GET /api2/<xsl:value-of select="/api/records_name"/>.table
            </xsl:element>
            </div>
            <div class="sample">
            <xsl:element name="a">
                <xsl:attribute name="href">../api2/<xsl:value-of select="/api/records_name"/>.csv?limit=3</xsl:attribute>
				<xsl:attribute name="target">_new</xsl:attribute>
				GET /api2/<xsl:value-of select="/api/records_name"/>.csv
            </xsl:element>
            </div>
            <div class="sample">
            <xsl:element name="a">
                <xsl:attribute name="href">../api2/<xsl:value-of select="/api/records_name"/>.xlsx?limit=3</xsl:attribute>
				<xsl:attribute name="target">_new</xsl:attribute>
				GET /api2/<xsl:value-of select="/api/records_name"/>.xlsx
            </xsl:element>
            </div>
        <h2>Fields list:</h2>
        <xsl:for-each select="/api/fields/*">
            <h3><xsl:value-of select="local-name()"/></h3>
            <xsl:if test="label!=''">
                Label: "<xsl:value-of select="label"/>"<br />
            </xsl:if>
            <xsl:if test="filter!=''">
                Filter: <xsl:value-of select="filter"/><br />
            </xsl:if>
            <xsl:if test="translate!=''">
                Translatable: <xsl:value-of select="translate"/><br />
            </xsl:if>

            <xsl:if test="valuelist!=''">
                Values:<ul>
                <xsl:for-each select="valuelist/*">
                    <xsl:sort select="substring(local-name(), 5)" data-type="number" />
                    <!-- substring om lov_ te strippen -->
                    <li><xsl:value-of select="substring(local-name(), 5)"/>: <xsl:value-of select="."/>
                    </li>
                </xsl:for-each>
                </ul>
            </xsl:if>
            <xsl:choose>
                <xsl:when test="comment!=''">
                    Comment: <xsl:value-of select="comment"/>
                </xsl:when>
                <xsl:when test="local-name()='id'">
                    Comment: Unique identification of <xsl:value-of select="/api/record_name"/>
                </xsl:when>
                <xsl:when test="local-name()='name'">
                    Comment: Name of <xsl:value-of select="/api/record_name"/>
                </xsl:when>
                <xsl:when test="hint!=''">
                    Hint: <xsl:value-of select="hint"/>
                </xsl:when>
                <xsl:when test="local-name()='deleted'">
                    Comment: Indication if and when <xsl:value-of select="/api/record_name"/> was deleted
                </xsl:when>
                <xsl:otherwise>
                </xsl:otherwise>
            </xsl:choose>

        </xsl:for-each>
        <p>&#169; Aareon Nederland BV. Use of the Facilitor API is restricted by the Facilitor-API regulations.</p>
    </body>
  </html>
</xsl:template>
</xsl:stylesheet>