<?xml version="1.0" encoding="UTF-8"?>

<!--
    Copyright
    2009 axYus - www.axyus.com
    2009 C.Marchand - christophe.marchand@axyus.com
    
    This file is part of XEMELIOS.
    
    XEMELIOS is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
    
    XEMELIOS is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with XEMELIOS; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">

    <xsl:output indent="yes" encoding="UTF-8" method="xml"/>

    <xsl:template match="/">
        <xsl:apply-templates/>
    </xsl:template>

    <xsl:template match="node()">
        <xsl:choose>
            <xsl:when test="local-name(.) = 'parameter'">
                <xsl:copy>
                    <xsl:attribute name="name"><xsl:value-of select="./@name"/></xsl:attribute>
                    <xsl:choose>
                        <xsl:when test="./@name = 'export.p1.max.size'">
                            <xsl:attribute name="value">3000</xsl:attribute>
                        </xsl:when>
                        <xsl:when test="./@name = 'export.p2.max.size'">
                            <xsl:attribute name="value">10000</xsl:attribute>
                        </xsl:when>
                        <xsl:when test="./@name = 'export.max.size'">
                            <xsl:attribute name="value">65000</xsl:attribute>
                        </xsl:when>
                        <xsl:when test="./@name='documents-def.dir'">%basedir%/documents-def</xsl:when>
                        <xsl:otherwise>
                            <xsl:if test="exists(./@value)"><xsl:attribute name="value"><xsl:value-of select="./@value"></xsl:value-of></xsl:attribute></xsl:if>
                        </xsl:otherwise>
                    </xsl:choose>
                    <xsl:if test="not(./@name = 'documents-def.dir')">
                        <xsl:apply-templates/>
                    </xsl:if>
                </xsl:copy>
            </xsl:when>
            <xsl:otherwise>
                <xsl:copy>
                    <xsl:for-each select="@*">
                        <xsl:choose>
                            <xsl:when test="local-name(.) = 'start-time'"><xsl:attribute name="start-time">21:00</xsl:attribute></xsl:when>
                            <xsl:otherwise><xsl:attribute name="{local-name(.)}">
                                <xsl:value-of select="."/>
                            </xsl:attribute></xsl:otherwise>
                        </xsl:choose>
                    </xsl:for-each>
                    <xsl:apply-templates/>
                </xsl:copy>
            </xsl:otherwise>
        </xsl:choose>
        
    </xsl:template>

    <xsl:template match="comment()[string-length(.) &gt; 50]">
        <xsl:comment>
            <xsl:value-of select="."/>
        </xsl:comment>
    </xsl:template>

</xsl:stylesheet>
