Hi Prateek,

I understand that you are using Struts in conjunction with OXF. You
have to modify struts.xpl to add a FOP Serializer, and to use it when
XSL-FO data is detected. I attached to this email a modified
struts.xpl with the following change:

   <p:when test="/fo:root">
       <!-- Auto-detected XSL-FO. Use the FOP Serializer -->
       <p:processor uri="oxf/processor/fop">
           <p:input name="config">
               <config/>
           </p:input>
           <p:input name="data" href="#page"/>
       </p:processor>
   </p:when>


This instructs OXF to use a FOP Serializer when the document coming from the action contains a "fo:root" root element. You can of course add a stylesheet before the FOP Serializer to transform an intermediate language (like the d:document into XSL-FO.

Regards,
Julien



Prateek Mittal wrote:
Hi,
  I need to generate a pdf document from a XML. I am trying to make use of
'FOP Serializer'. Can anyone provide some details, how can I make use of it
and generate a pdf doc.
  Do I need to replace html-serializer with text-serializer (FOPSerializer)
in struts.xpl or I can just add it there? I don't want to loose ability of
generating html pages either. A short example could be very helpful.

Regards,
Prateek

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

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline";
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:d="http://orbeon.org/oxf/xml/document";
    xmlns:fo="http://www.w3.org/1999/XSL/Format";>

    <p:processor uri="oxf/processor/request">
        <p:input name="config">
            <config>
                <include>/request/request-path</include>
            </config>
        </p:input>
        <p:output name="data" id="path"/>
    </p:processor>

    <p:choose href="#path">
        <p:when test="contains(/request/request-path, '.css') or 
contains(/request/request-path, '.js') or contains(/request/request-path, '.gif') or 
contains(/request/request-path, '.png')">
            <p:processor uri="oxf/processor/resource-server">
                <p:input name="config" href="aggregate('path', 
#path#xpointer(string(/request/request-path)))"/>
                <p:input name="mime-type" href="oxf:/oxf/mime-types.xml"/>
            </p:processor>
        </p:when>

        <p:otherwise>

            <p:processor uri="oxf/processor/xslt">
                <p:input name="config">
                    <xsl:stylesheet version="1.0">
                        <xsl:template match="/">
                            <config>oxf:<xsl:value-of 
select="/request/request-path"/></config>
                        </xsl:template>
                    </xsl:stylesheet>
                </p:input>
                <p:input name="data" href="#path"/>
                <p:output name="data" id="url"/>
            </p:processor>

            <p:processor uri="oxf/processor/url-generator">
                <p:input name="config" href="#url"/>
                <p:output name="data" id="user-pipeline"/>
            </p:processor>


            <p:processor uri="oxf/processor/xslt">
                <p:input name="data" href="aggregate('root', #user-pipeline, #url)"/>
                <p:input name="config">
                    <xsl:stylesheet version="1.0">
                        <xsl:template match="/">
                            <p:config>

                                <xsl:for-each select="/root/p:config/p:[EMAIL 
PROTECTED]'input' and @name != 'errors']">
                                    <p:processor uri="oxf/processor/bean-generator">
                                        <p:input name="mapping">
                                            <mapping/>
                                        </p:input>
                                        <p:input name="config">
                                            <config>
                                                <attribute>
                                                    <xsl:value-of select="@name"/>
                                                </attribute>
                                                <source>request</source>
                                            </config>
                                        </p:input>
                                        <p:output name="data" id="[EMAIL PROTECTED]"/>
                                    </p:processor>
                                </xsl:for-each>

                                <xsl:if test="/root/p:config/p:[EMAIL 
PROTECTED]'input' and @name = 'errors']">
                                    <p:processor 
uri="oxf/processor/struts-errors-generator">
                                        <p:output name="data" id="errors"/>
                                    </p:processor>
                                </xsl:if>

                                <p:processor uri="oxf/processor/url-generator">
                                    <p:input name="config">
                                        <config>
                                            <xsl:value-of select="/root/config"/>
                                        </config>
                                    </p:input>
                                    <p:output name="data" id="user-pipeline"/>
                                </p:processor>

                                <p:processor uri="oxf/processor/pipeline">
                                    <p:input name="config" href="#user-pipeline"/>
                                    <xsl:for-each select="/root/p:config/p:[EMAIL 
PROTECTED]'input' and @name != 'errors']">
                                        <p:input name="[EMAIL PROTECTED]" href="[EMAIL 
PROTECTED]"/>
                                    </xsl:for-each>
                                    <xsl:if test="/root/p:config/p:[EMAIL 
PROTECTED]'input' and @name = 'errors']">
                                        <p:input name="errors" href="#errors"/>
                                    </xsl:if>
                                    <p:output name="data" id="page"/>
                                </p:processor>

                                <p:choose href="#page">
                                    <p:when test="/d:portlet">
                                        <!-- Portlets don't go through epilogue -->
                                        <p:processor 
uri="oxf/processor/xml-serializer">
                                            <p:input name="config">
                                                <config/>
                                            </p:input>
                                            <p:input name="data" href="#page"/>
                                        </p:processor>

                                    </p:when>
                                    <p:when test="/fo:root">
                                        <!-- Auto-detected XSL-FO. Use the FOP 
Serializer -->
                                        <p:processor uri="oxf/processor/fop">
                                            <p:input name="config">
                                                <config/>
                                            </p:input>
                                            <p:input name="data" href="#page"/>
                                        </p:processor>
                                    </p:when>
                                    <p:otherwise>
                                        <!-- Regular output goes through epilogue -->
                                        <p:processor uri="oxf/processor/pipeline">
                                            <p:input name="config" 
href="oxf:/config/epilogue.xpl"/>
                                            <p:input name="data" href="#page"/>
                                            <p:output name="data" id="html"/>
                                        </p:processor>

                                        <p:processor 
uri="oxf/processor/html-serializer">
                                            <p:input name="config">
                                                <config/>
                                            </p:input>
                                            <p:input name="data" href="#html"/>
                                        </p:processor>

                                    </p:otherwise>
                                </p:choose>

                            </p:config>
                        </xsl:template>
                    </xsl:stylesheet>
                </p:input>
                <p:output name="data" id="pipeline"/>
            </p:processor>

            <p:processor uri="oxf/processor/pipeline">
                <p:input name="config" href="#pipeline"/>
            </p:processor>

        </p:otherwise>

    </p:choose>

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

Reply via email to