<commit_before><!--
    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:xhtml="http://www.w3.org/1999/xhtml"
        xmlns:xforms="http://www.w3.org/2002/xforms"
        xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
        xmlns:ev="http://www.w3.org/2001/xml-events"
        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"
        xmlns:form-runner="java:org.orbeon.oxf.fr.FormRunner">

    <!-- 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:xforms-to-xhtml">
        <p:input name="annotated-document" transform="oxf:xinclude" href="aggregate('dummy')">
            <xhtml:html>
                <xhtml:head>
                    <xhtml:title/>
                    <xforms:model xxforms:optimize-get-all="false">
                        <xxforms:variable name="app" select="instance('fr-parameters-instance')/app"/>
                        <xxforms:variable name="form" select="instance('fr-parameters-instance')/form"/>
                        <xforms:instance id="fr-parameters-instance" src="input:instance"/>
                        <xforms:submission id="get-source-form-submission" method="get" serialization="none"
                                resource="/fr/service/persistence/crud/{$app}/{$form}/form/form.xhtml{
                                    if (instance('fr-parameters-instance')/document != '') then concat('?document=', instance('fr-parameters-instance')/document) else ''}"
                                replace="all" xxforms:xinclude="true">
                            <!-- HACK: we test on the request path to make this work for the toolbox, but really we should handle this in a different way -->
                            <xforms:action ev:event="xforms-submit-error" type="xpath">
                                if (xxforms:get-request-path() != '/fr/service/custom/orbeon/newbuilder/toolbox')
                                then form-runner:sendError((event('response-status-code'), 500)[1])
                                else ()
                            </xforms:action>
                        </xforms:submission><commit_msg>Variation re. "Temporary hack to not interrupt processing when loading toolbox if library forms are not found."<commit_after><!--
    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:xhtml="http://www.w3.org/1999/xhtml"
        xmlns:xforms="http://www.w3.org/2002/xforms"
        xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
        xmlns:ev="http://www.w3.org/2001/xml-events"
        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"
        xmlns:form-runner="java:org.orbeon.oxf.fr.FormRunner">

    <!-- 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:xforms-to-xhtml">
        <p:input name="annotated-document" transform="oxf:xinclude" href="aggregate('dummy')">
            <xhtml:html>
                <xhtml:head>
                    <xhtml:title/>
                    <xforms:model xxforms:optimize-get-all="false">
                        <xxforms:variable name="app" select="instance('fr-parameters-instance')/app"/>
                        <xxforms:variable name="form" select="instance('fr-parameters-instance')/form"/>
                        <xforms:instance id="fr-parameters-instance" src="input:instance"/>
                        <xforms:submission id="get-source-form-submission" method="get" serialization="none"
                                resource="/fr/service/persistence/crud/{$app}/{$form}/form/form.xhtml{
                                    if (instance('fr-parameters-instance')/document != '') then concat('?document=', instance('fr-parameters-instance')/document) else ''}"
                                replace="all" xxforms:xinclude="true">
                            <!-- HACK: we test on the request path to make this work for the toolbox, but really we should handle this in a different way -->
                            <xforms:action ev:event="xforms-submit-error" type="xpath">
                                if (not(matches(xxforms:get-request-path(), '/fr/service/custom/orbeon/(new)?builder/toolbox')))
                                then form-runner:sendError((event('response-status-code'), 500)[1])
                                else ()
                            </xforms:action>
                        </xforms:submission>
{'fraction_non_alphanumeric': 0.13452647278150634, 'fraction_numerical': 0.013422818791946308, 'mean_word_length': 2.3165182987141444, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 20, 'xml': 28}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4928175', 'n_tokens_mistral': 1967, 'n_tokens_neox': 1850, 'n_words': 427}