Hi, I’m starting to play with OXF. As this subject may interest all beginners, I’ll just give this more commented example :

Hope it will help (see the comment within the code)

 

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"> 

            <p:param type="output" name="data"/>

           

            <!--

                        we catch the received parameter which follows this schema :

                       

                        <request>

                                    <parameters>

                                                <parameter>

                                                            <name>name_of_the_parameter</name>

                                                            <value>value_of_the_parameter</value>

                                                </parameter>

                                    </parameters>

                        </request                                 

            -->

           

            <p:processor uri="oxf/processor/request">

            <p:input name="config">

                        <config>

                        <include>/request/parameters</include>

            </config>

            </p:input>

            <p:output name="data" id="request"/>

            </p:processor>

           

            <!--

                        referencing the "request" output, we test it :

                        depending on the parameter name ("local" or "external"), the right

                        processor is called to aggregate the path of the xml file to be

                        sent as "document" output for next processor to make xslt transformation

                       

                        example :

                        http://localhost:8080/magiccv?local=cv_0000001.xml

                        or

                        http://localhost:8080/magiccv?external=http://my-server.com/cv_0000002.xml

            -->

           

            <p:choose href="#request" xmlns:p="http://www.orbeon.com/oxf/pipeline">

                        <p:when test="/request/parameters/parameter/name='local'">

                                    <p:processor uri="oxf/processor/url-generator">

                                                <p:input name="config" href="aggregate('config', #request#xpointer(concat('oxf:', /request/parameters/parameter[name='local']/value)))" />

                                    <p:output name="data" id="document" />

            </p:processor>

                        </p:when>       

                        <p:when test="/request/parameters/parameter/name='external'">

                                    <p:processor uri="oxf/processor/url-generator">

                                                <p:input name="config" href="aggregate('config', #request#xpointer(concat('', /request/parameters/parameter[name='external']/value)))" />

                                    <p:output name="data" id="document" />

            </p:processor>

                        </p:when>

            </p:choose>                

           

            <!--

                        this processor will make the xslt transformation to the xml document, taking the preceding example, the input xml will be :

                        oxf:cv_0000001.xml

                        or

                        http://my-server.com/cv_0000002.xml

            -->

           

            <p:processor uri="oxf/processor/xslt">              

            <p:input name="data" href="#document" />

    <p:input name="config" href="magiccv.xsl" />

    <p:output name="data" ref="data"/>

  </p:processor>

 

</p:config>

_______________________________________________
oxf-users mailing list
[EMAIL PROTECTED]
http://mail.orbeon.com/mailman/listinfo/oxf-users

Reply via email to