<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
          xmlns:oxf="http://www.orbeon.com/oxf/processors"
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          xmlns:sql="http://orbeon.org/oxf/xml/sql">


    
      <!-- rechercher un utilisateur avec le login et le password saisis -->
    <p:param name="instance" type="input"/>
    <p:processor name="oxf:sql">
          <p:input name="data" href="#instance" />
          <p:input name="datasource" href="oxf:/FormationOrbeon/TestMigration/Datasource/datasource.xml" />
          <p:input name="config">
              <sql:config>
                  <sql:connection>
                      <!-- <sql:datasource>Rachid</sql:datasource> -->
                      <personne>
                          <sql:execute>
                             <sql:query>
                                select * from user where login=
                                 <sql:param type='xs:string' select="/form/authentification/login" />
                                  and password=
                                 <sql:param type='xs:string' select="/form/authentification/password" />
                             </sql:query>
                     
                          <sql:results>
                             <sql:row-results>
                              
                                    <sql:get-columns format="xml" />
                                
                             </sql:row-results>
                          </sql:results> 
                    
                      </sql:execute>
                          </personne>  
                          
                  </sql:connection>
              </sql:config>
          </p:input>
        <p:output name="data" id="resultat" />
     </p:processor>
    
    <p:processor name="oxf:file-serializer">
                  <p:input name="config">
                      <config>
                           <content-type>text/html</content-type>
                          <directory>c:/</directory>
                          <file>ppppp.html</file>
                      </config>
                  </p:input>
                  <p:input name="data" href="#resultat" />
            </p:processor>
    <!-- determination de la page vers laquelle on va rediriger l'utilisateur -->
    
    <p:processor name="oxf:xslt" xmlns:p="http://www.orbeon.com/oxf/pipeline">
                   <p:input name="data" href="#resultat" />
                   <p:input name="config">
                       <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
                        <xsl:template match="/">
                           <xsl:if test="count(/personne/login)=0">
                               <redirect-url xsl:version="2.0">
                                   <server-side>false</server-side>
                                   <path-info><xsl:value-of select="'/error'"/></path-info>
                               </redirect-url>
                           </xsl:if>
                           <xsl:if test="count(/personne/login)!=0">
                               <redirect-url xsl:version="2.0">
                                   <server-side>false</server-side>
                                   <path-info><xsl:value-of select="'/welcome'"/></path-info>
                               </redirect-url>
                           </xsl:if>
                        </xsl:template>
                       </xsl:stylesheet>
                   </p:input>
                   <p:output name="data" id="url-config"/>
            </p:processor>
    
    <!-- redirection avec le processor oxf:redirect -->
    <p:processor name="oxf:redirect" xmlns:p="http://www.orbeon.com/oxf/pipeline"> 
        <p:input name="data" href="#url-config"/>
    </p:processor>
    

</p:config>
