<commit_before><?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright (C) 2009-2010 Orbeon, Inc.

    This program is free software; you can redistribute it and/or modify it under the terms of the
    GNU Lesser General Public License as published by the Free Software Foundation; either version
    2.1 of the License, or (at your option) any later version.

    This program 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 Lesser General Public License for more details.

    The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
-->
<!DOCTYPE xsl:transform [
<!ENTITY neutralElementsInHeaderOrBody "self::xxforms:variable|self::xforms:action|self::xforms:setvalue|self::xforms:insert|self::xforms:delete|self::xforms:setindex|self::xforms:toggle|self::xforms:setfocus|self::xforms:dispatch|self::xforms:rebuild|self::xforms:recalculate|self::xforms:revalidate|self::xforms:refresh|self::xforms:reset|self::xforms:load|self::xforms:send">
]>
<xsl:transform xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xhtml="http://www.w3.org/1999/xhtml"
    xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
    xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:exf="http://www.exforms.org/exf/1-0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="2.0">

    <xsl:variable name="parameters">
        <!-- These optional attributes are used as parameters -->
        <parameter>appearance</parameter>
        <parameter>scrollable</parameter>
        <parameter>width</parameter>
        <parameter>height</parameter>
        <parameter>paginated</parameter>
        <parameter>rowsPerPage</parameter>
        <parameter>sortAndPaginationMode</parameter>
        <parameter>nbPages</parameter>
        <parameter>maxNbPagesToDisplay</parameter>
        <parameter>page</parameter>
        <parameter>innerTableWidth</parameter>
        <parameter>loading</parameter>
        <parameter>dynamic</parameter>
        <parameter>debug</parameter>
    </xsl:variable>


    <xsl:variable name="numberTypes">
        <type>xs:decimal</type>
        <type>xs:integer</type>
        <type>xs:nonPositiveInteger</type>
        <type>xs:negativeInteger</type>
        <type>xs:long</type>
        <type>xs:int</type>
        <type>xs:short</type>
        <type>xs:byte</type>
        <type>xs:nonNegativeInteger</type>
        <type>xs:unsignedLong</type>
        <type>xs:unsignedInt</type>
        <type>xs:unsignedShort</type>
        <type>xs:unsignedByte</type>
        <type>xs:positiveInteger</type>
    </xsl:variable>
    <xsl:variable name="numberTypesEnumeration">
        <xsl:for-each select="$numberTypes/*">
            <xsl:if test="position() >1">,</xsl:if>
            <xsl:text>resolve-QName('</xsl:text>
            <xsl:value-of select="."/>
            <xsl:text>', $fr-dt-datatable-instance)</xsl:text>
        </xsl:for-each>
    </xsl:variable>

    <!-- Perform pass 1 to 4 to support simplified syntaxes -->
    <xsl:variable name="pass1">
        <xsl:apply-templates select="/" mode="pass1"/>
    </xsl:variable>

    <xsl:variable name="pass2">
        <xsl:apply-templates select="$pass1" mode="pass2"/>
    </xsl:variable>

    <xsl:variable name="pass3">
        <xsl:apply-templates select="$pass2" mode="pass3"/>
    </xsl:variable>

    <xsl:variable name="pass4">
        <xsl:apply-templates select="$pass3" mode="pass4"/>
    </xsl:variable>

    <xsl:variable name="pass5">
        <xsl:apply-templates select="$pass4" mode="pass5"/>
    </xsl:variable>

    <!-- Set some variables that will dictate the geometry of the widget -->
    <xsl:variable name="scrollH" select="$pass5/fr:datatable/@scrollable = ('horizontal', 'both') and $pass5/fr:datatable/@width"/>
    <xsl:variable name="scrollV" select="$pass5/fr:datatable/@scrollable = ('vertical', 'both') and $pass5/fr:datatable/@height"/>
    <xsl:variable name="scrollable" select="$scrollH or $scrollV"/>
    <xsl:variable name="height" select="if ($scrollV) then concat('height: ', $pass5/fr:datatable/@height, ';') else ''"/>
    <xsl:variable name="width" select="if ($pass5/fr:datatable/@width) then concat('width: ', $pass5/fr:datatable/@width, ';') else ''"/>
    <xsl:variable name="id">
        <xsl:choose>
            <xsl:when test="$pass5/fr:datatable/@id">
                <id xxbl:scope="outer">
                    <xsl:value-of select="$pass5/fr:datatable/@id"/>
                </id>
            </xsl:when>
            <xsl:otherwise>
                <id xxbl:scope="inner">
                    <xsl:value-of select="generate-id($pass5/fr:datatable)"/>
                </id>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <xsl:variable name="paginated" select="$pass5/fr:datatable/@paginated = 'true'"/>
    <xsl:variable name="rowsPerPage"
        select="if ($pass5/fr:datatable/@rowsPerPage castable as xs:integer) then $pass5/fr:datatable/@rowsPerPage cast as xs:integer else 10"/>
    <xsl:variable name="maxNbPagesToDisplay"
        select="if ($pass5/fr:datatable/@maxNbPagesToDisplay castable as xs:integer) then $pass5/fr:datatable/@maxNbPagesToDisplay cast as xs:integer else -1"/>
    <xsl:variable name="sortAndPaginationMode" select="$pass5/fr:datatable/@sortAndPaginationMode"/>
    <xsl:variable name="isExternallySortedAndPaginated" select="$sortAndPaginationMode = 'external'"/>
    <xsl:variable name="isInternallySortedAndPaginated" select="not($isExternallySortedAndPaginated)"/>
    <xsl:variable name="innerTableWidth" select="$pass5/fr:datatable/@innerTableWidth"/>
    <xsl:variable name="innerTableWidthJS" select="if ($innerTableWidth) then concat(&quot;'&quot;, $innerTableWidth, &quot;'&quot;) else 'null'"/>
    <xsl:variable name="innerTableWidthCSS" select="if ($innerTableWidth) then concat('width: ', $innerTableWidth, ';') else ''"/>
    <xsl:variable name="hasLoadingFeature" select="count($pass5/fr:datatable/@loading) = 1"/>
    <xsl:variable name="debug" select="$pass5/fr:datatable/@debug = 'true'"/>

    <!-- And some more -->

    <xsl:variable name="repeatNodeset" select="$pass5/fr:datatable/xhtml:tbody/xforms:repeat/@nodeset"/>

    <xsl:template match="@*|node()" mode="#all" priority="-100" name="identity">
        <!-- Default template == identity -->
        <xsl:copy>
            <xsl:apply-templates select="@*|node()" mode="#current"/>
        </xsl:copy>
    </xsl:template><commit_msg>Silently round datatable maxNbPagesToDisplay attribute to the nearest larger odd value when an even value was specified so that the pagination control can get centered fine<commit_after><?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright (C) 2009-2010 Orbeon, Inc.

    This program is free software; you can redistribute it and/or modify it under the terms of the
    GNU Lesser General Public License as published by the Free Software Foundation; either version
    2.1 of the License, or (at your option) any later version.

    This program 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 Lesser General Public License for more details.

    The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
-->
<!DOCTYPE xsl:transform [
<!ENTITY neutralElementsInHeaderOrBody "self::xxforms:variable|self::xforms:action|self::xforms:setvalue|self::xforms:insert|self::xforms:delete|self::xforms:setindex|self::xforms:toggle|self::xforms:setfocus|self::xforms:dispatch|self::xforms:rebuild|self::xforms:recalculate|self::xforms:revalidate|self::xforms:refresh|self::xforms:reset|self::xforms:load|self::xforms:send">
]>
<xsl:transform xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xhtml="http://www.w3.org/1999/xhtml"
    xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
    xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:exf="http://www.exforms.org/exf/1-0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="2.0">

    <xsl:variable name="parameters">
        <!-- These optional attributes are used as parameters -->
        <parameter>appearance</parameter>
        <parameter>scrollable</parameter>
        <parameter>width</parameter>
        <parameter>height</parameter>
        <parameter>paginated</parameter>
        <parameter>rowsPerPage</parameter>
        <parameter>sortAndPaginationMode</parameter>
        <parameter>nbPages</parameter>
        <parameter>maxNbPagesToDisplay</parameter>
        <parameter>page</parameter>
        <parameter>innerTableWidth</parameter>
        <parameter>loading</parameter>
        <parameter>dynamic</parameter>
        <parameter>debug</parameter>
    </xsl:variable>


    <xsl:variable name="numberTypes">
        <type>xs:decimal</type>
        <type>xs:integer</type>
        <type>xs:nonPositiveInteger</type>
        <type>xs:negativeInteger</type>
        <type>xs:long</type>
        <type>xs:int</type>
        <type>xs:short</type>
        <type>xs:byte</type>
        <type>xs:nonNegativeInteger</type>
        <type>xs:unsignedLong</type>
        <type>xs:unsignedInt</type>
        <type>xs:unsignedShort</type>
        <type>xs:unsignedByte</type>
        <type>xs:positiveInteger</type>
    </xsl:variable>
    <xsl:variable name="numberTypesEnumeration">
        <xsl:for-each select="$numberTypes/*">
            <xsl:if test="position() >1">,</xsl:if>
            <xsl:text>resolve-QName('</xsl:text>
            <xsl:value-of select="."/>
            <xsl:text>', $fr-dt-datatable-instance)</xsl:text>
        </xsl:for-each>
    </xsl:variable>

    <!-- Perform pass 1 to 4 to support simplified syntaxes -->
    <xsl:variable name="pass1">
        <xsl:apply-templates select="/" mode="pass1"/>
    </xsl:variable>

    <xsl:variable name="pass2">
        <xsl:apply-templates select="$pass1" mode="pass2"/>
    </xsl:variable>

    <xsl:variable name="pass3">
        <xsl:apply-templates select="$pass2" mode="pass3"/>
    </xsl:variable>

    <xsl:variable name="pass4">
        <xsl:apply-templates select="$pass3" mode="pass4"/>
    </xsl:variable>

    <xsl:variable name="pass5">
        <xsl:apply-templates select="$pass4" mode="pass5"/>
    </xsl:variable>

    <!-- Set some variables that will dictate the geometry of the widget -->
    <xsl:variable name="scrollH" select="$pass5/fr:datatable/@scrollable = ('horizontal', 'both') and $pass5/fr:datatable/@width"/>
    <xsl:variable name="scrollV" select="$pass5/fr:datatable/@scrollable = ('vertical', 'both') and $pass5/fr:datatable/@height"/>
    <xsl:variable name="scrollable" select="$scrollH or $scrollV"/>
    <xsl:variable name="height" select="if ($scrollV) then concat('height: ', $pass5/fr:datatable/@height, ';') else ''"/>
    <xsl:variable name="width" select="if ($pass5/fr:datatable/@width) then concat('width: ', $pass5/fr:datatable/@width, ';') else ''"/>
    <xsl:variable name="id">
        <xsl:choose>
            <xsl:when test="$pass5/fr:datatable/@id">
                <id xxbl:scope="outer">
                    <xsl:value-of select="$pass5/fr:datatable/@id"/>
                </id>
            </xsl:when>
            <xsl:otherwise>
                <id xxbl:scope="inner">
                    <xsl:value-of select="generate-id($pass5/fr:datatable)"/>
                </id>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <xsl:variable name="paginated" select="$pass5/fr:datatable/@paginated = 'true'"/>
    <xsl:variable name="rowsPerPage"
        select="if ($pass5/fr:datatable/@rowsPerPage castable as xs:integer) then $pass5/fr:datatable/@rowsPerPage cast as xs:integer else 10"/>
    <xsl:variable name="maxNbPagesToDisplay"
        select="if ($pass5/fr:datatable/@maxNbPagesToDisplay castable as xs:integer) 
            then if ($pass5/fr:datatable/@maxNbPagesToDisplay cast as xs:integer mod 2 = 0 )
                then $pass5/fr:datatable/@maxNbPagesToDisplay cast as xs:integer + 1
                else $pass5/fr:datatable/@maxNbPagesToDisplay cast as xs:integer
            else -1"/>
    <xsl:variable name="sortAndPaginationMode" select="$pass5/fr:datatable/@sortAndPaginationMode"/>
    <xsl:variable name="isExternallySortedAndPaginated" select="$sortAndPaginationMode = 'external'"/>
    <xsl:variable name="isInternallySortedAndPaginated" select="not($isExternallySortedAndPaginated)"/>
    <xsl:variable name="innerTableWidth" select="$pass5/fr:datatable/@innerTableWidth"/>
    <xsl:variable name="innerTableWidthJS" select="if ($innerTableWidth) then concat(&quot;'&quot;, $innerTableWidth, &quot;'&quot;) else 'null'"/>
    <xsl:variable name="innerTableWidthCSS" select="if ($innerTableWidth) then concat('width: ', $innerTableWidth, ';') else ''"/>
    <xsl:variable name="hasLoadingFeature" select="count($pass5/fr:datatable/@loading) = 1"/>
    <xsl:variable name="debug" select="$pass5/fr:datatable/@debug = 'true'"/>

    <!-- And some more -->

    <xsl:variable name="repeatNodeset" select="$pass5/fr:datatable/xhtml:tbody/xforms:repeat/@nodeset"/>

    <xsl:template match="@*|node()" mode="#all" priority="-100" name="identity">
        <!-- Default template == identity -->
        <xsl:copy>
            <xsl:apply-templates select="@*|node()" mode="#current"/>
        </xsl:copy>
    </xsl:template>
{'fraction_non_alphanumeric': 0.16587677725118483, 'fraction_numerical': 0.012853655033749821, 'mean_word_length': 3.719417146729922, 'pattern_counts': {'":': 0, '<': 267, '<?xml version=': 2, '>': 269, 'https://': 0, 'lorem ipsum': 0, 'www.': 18, 'xml': 32}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6984624', 'n_tokens_mistral': 4621, 'n_tokens_neox': 4286, 'n_words': 775}