xsl-list
[Top] [All Lists]

Re: [xsl] Working example xml+xsl to .fo file

2008-11-18 13:17:09
eleonora46(_at_)gmx(_dot_)net wrote:

No, that is just a working .fo file.
I have such sample files in fop package.
I need the way from xml+xsl to .fo file.

Well write a stylesheet that creates an XSL-FO document as its result:

<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:fo="http://www.w3.org/1999/XSL/Format";
  version="1.0">

<xsl:template match="/">
<fo:root>Œ
    <fo:layout-master-set>
<fo:simple-page-master master-name="LetterPage" page-width="8.5in"
                               page-height="11in" >Ž
            <fo:region-body region-name="PageBody" margin="0.7in"/>
        </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence master-reference="LetterPage">
        <fo:flow flow-name="PageBody">
            <fo:block>Hello World</fo:block> 
        </fo:flow>
    </fo:page-sequence>
</fo:root>
</xsl:template>

</xsl:stylesheet>

In a real stylesheet you would obviously fill the XSL-FO document with data from an XML document but as a Hello Word example the above suffices, it creates the without taking any data from the XML input.

If you want a Hello world example for that then use e.g

<foo>bar</foo>

as the XML input document and then change the stylesheet to

<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:fo="http://www.w3.org/1999/XSL/Format";
  version="1.0">

<xsl:template match="/">
<fo:root>Œ
    <fo:layout-master-set>
<fo:simple-page-master master-name="LetterPage" page-width="8.5in"
                               page-height="11in" >Ž
            <fo:region-body region-name="PageBody" margin="0.7in"/>
        </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence master-reference="LetterPage">
        <fo:flow flow-name="PageBody">
            <fo:block>Hello World <xsl:value-of select="foo"/></fo:block> 
        </fo:flow>
    </fo:page-sequence>
</fo:root>
</xsl:template>

</xsl:stylesheet>



--

        Martin Honnen
        http://JavaScript.FAQTs.com/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>