<commit_before><?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2008 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
-->
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:oxf="http://www.orbeon.com/oxf/processors"
        xmlns:xi="http://www.w3.org/2001/XInclude"
        xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary">

    <!-- Parameters (app, form, document, and mode) -->
    <p:param type="input" name="instance"/>
    <!-- XHTML+FR+XForms for the from obtained from persistence layer -->
    <p:param type="output" name="data"/>

    <!-- Call up persistence layer to obtain XHTML+XForms -->
    <p:processor name="oxf:url-generator">
        <p:input name="config" transform="oxf:unsafe-xslt" href="#instance">
            <config xsl:version="2.0">

                <!-- /*/document is available e.g. when editing or viewing a document -->
                <xsl:variable name="document" select="/*/document" as="xs:string"/>

                <!-- Create URI based on properties -->
                <xsl:variable name="resource"
                              select="concat(pipeline:property('oxf.fr.appserver.uri'),
                                        pipeline:property(string-join(('oxf.fr.persistence.app.uri', /*/app, /*/form, 'form'), '.')),
                                        '/crud/', /*/app, '/', /*/form, '/form/form.xhtml',
                                        if ($document != '') then concat('?document=', $document) else '')" as="xs:string"/>
                <url>
                    <xsl:value-of select="pipeline:rewriteResourceURI($resource, true())"/>
                </url>
                <!-- Forward the same headers that the XForms engine forwards -->
                <forward-headers><xsl:value-of select="pipeline:property('oxf.xforms.forward-submission-headers')"/></forward-headers>
                <!-- Produce binary so we do our own XML parsing -->
                <mode>binary</mode>
            </config>
        </p:input>
        <p:output name="data" id="binary-document"/>
    </p:processor>

    <!-- Convert binary document to XML -->
    <p:processor name="oxf:to-xml-converter">
        <p:input name="config">
            <!-- Don't handle XInclude as this is done down the line -->
            <config><handle-xinclude>false</handle-xinclude></config>
        </p:input>
        <p:input name="data" href="#binary-document"/>
        <p:output name="data" id="document"/>
    </p:processor>

    <!-- Handle XInclude (mainly for "resource" type of persistence) -->
    <p:processor name="oxf:xinclude">
        <p:input name="config" href="#document"/>
        <p:output name="data" id="after-xinclude" ref="data"/>
    </p:processor>

    <!-- Store document in the request for further access down the line -->
    <p:processor name="oxf:scope-serializer">
        <p:input name="config">
            <config>
                <key>oxf.fr.form</key>
                <scope>request</scope>
            </config>
        </p:input>
        <p:input name="data" href="#after-xinclude"/>
    </p:processor>

</p:config><commit_msg>read-form.xpl returns a null doc if the form is not found so that we can ignore the error when building components.<commit_after><?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2008 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
-->
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:oxf="http://www.orbeon.com/oxf/processors"
        xmlns:xi="http://www.w3.org/2001/XInclude"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary">

    <!-- Parameters (app, form, document, and mode) -->
    <p:param type="input" name="instance"/>
    <!-- XHTML+FR+XForms for the from obtained from persistence layer -->
    <p:param type="output" name="data"/>

    <!-- Call up persistence layer to obtain XHTML+XForms -->
    <p:processor name="oxf:url-generator">
        <p:input name="config" transform="oxf:unsafe-xslt" href="#instance">
            <config xsl:version="2.0">

                <!-- /*/document is available e.g. when editing or viewing a document -->
                <xsl:variable name="document" select="/*/document" as="xs:string"/>

                <!-- Create URI based on properties -->
                <xsl:variable name="resource"
                              select="concat(pipeline:property('oxf.fr.appserver.uri'),
                                        pipeline:property(string-join(('oxf.fr.persistence.app.uri', /*/app, /*/form, 'form'), '.')),
                                        '/crud/', /*/app, '/', /*/form, '/form/form.xhtml',
                                        if ($document != '') then concat('?document=', $document) else '')" as="xs:string"/>
                <url>
                    <xsl:value-of select="pipeline:rewriteResourceURI($resource, true())"/>
                </url>
                <!-- Forward the same headers that the XForms engine forwards -->
                <forward-headers><xsl:value-of select="pipeline:property('oxf.xforms.forward-submission-headers')"/></forward-headers>
                <!-- Produce binary so we do our own XML parsing -->
                <mode>binary</mode>
            </config>
        </p:input>
        <p:output name="data" id="binary-document"/>
    </p:processor>

    <p:choose href="#binary-document">
        <p:when test="contains(/*/@content-type, 'xml')">
            <!-- Convert binary document to XML -->
            <p:processor name="oxf:to-xml-converter">
                <p:input name="config">
                    <!-- Don't handle XInclude as this is done down the line -->
                    <config><handle-xinclude>false</handle-xinclude></config>
                </p:input>
                <p:input name="data" href="#binary-document"/>
                <p:output name="data" id="document"/>
            </p:processor>

            <!-- Handle XInclude (mainly for "resource" type of persistence) -->
            <p:processor name="oxf:xinclude">
                <p:input name="config" href="#document"/>
                <p:output name="data" id="after-xinclude" ref="data"/>
            </p:processor>

            <!-- Store document in the request for further access down the line -->
            <p:processor name="oxf:scope-serializer">
                <p:input name="config">
                    <config>
                        <key>oxf.fr.form</key>
                        <scope>request</scope>
                    </config>
                </p:input>
                <p:input name="data" href="#after-xinclude"/>
            </p:processor>
        </p:when>
        <p:otherwise>
            <!-- Null document -->
            <p:processor name="oxf:identity">
                <p:input name="data">
                    <null xsi:nil="true"/>
                </p:input>
                <p:output name="data" ref="data"/>
            </p:processor>
        </p:otherwise>
    </p:choose>

</p:config>
{'fraction_non_alphanumeric': 0.15132900177200237, 'fraction_numerical': 0.006733608978145304, 'mean_word_length': 2.084153005464481, 'pattern_counts': {'":': 0, '<': 134, '<?xml version=': 2, '>': 134, 'https://': 0, 'lorem ipsum': 0, 'www.': 13, 'xml': 18}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6428148', 'n_tokens_mistral': 2399, 'n_tokens_neox': 2284, 'n_words': 604}