File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes To display  XSL-FO content  on a browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "To display  XSL-FO content  on a browser" Watch "To display  XSL-FO content  on a browser" New topic
Author

To display XSL-FO content on a browser

khateeb syed
Greenhorn

Joined: Jun 25, 2005
Posts: 9
Hello,

I'm new to XML technology. i tried displaying content written inside an XSL-FO file & i could very well see the result. But all the while i couldnt see the effect of line 1 on content of line 2.


I have the below file saved as Demo.fo
_______________________________________
<?xml version="1.0" encoding="ISO-8859-1"?>

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

<fo:layout-master-set>
<fo:simple-page-master master-name="A4">
<fo:region-body margin="10cm"/>
</fo:simple-page-master>
</fo:layout-master-set>

<fo:page-sequence master-reference="A4">
<fo:flow flow-name="xsl-region-body">
<fo:block font-size="100pt" line-height="50pt"> line--- 1
Welcome to XML FO line --- 2
</fo:block>
</fo:flow>
</fo:page-sequence>

</fo:root>
---------------------------------------------------------
The XML file to display the content inside the Demo.fo file

<?xml version="1.0"?>

<?xml:stylesheet href="Demo.fo" type="text/xsl"?>

<menu>
<lunch>
<rice>Fried</rice>
<curry>Dal</curry>
</lunch>
</menu>
___________________________________________________________

Regards,
Khateeb.
khateeb syed
Greenhorn

Joined: Jun 25, 2005
Posts: 9
Continuing with my question above:
While when i try XSLT to display XML data, i dont see the effect again of the line 1.
i.e "Fried" is getting printed but the font-size & line-height attribute are not having the formatting effect on the xml result.
____________________________________________________________________________
Demo.xsl
--------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xslutput method="html" version="1.0" />
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="only">
<fo:region-body />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="only">
<fo:flow flow-name="xsl-region-body">
<fo:block font-size="100pt" line-height="50pt"> ----1
<xsl:value-of select="menu/lunch/rice"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
---------------------------------------------------------------------------
Demo.xml
--------
<?xml version="1.0"?>

<?xml:stylesheet href="Demo.xsl" type="text/xsl"?>

<menu>

<lunch>
<rice>Fried</rice>
<curry>Dal</curry>
</lunch>

<dinner>
<rice>Plain</rice>
<curry>Sambar</curry>
</dinner>

</menu>
___________________________________________________________________________

Thanks & regards,
Khateeb.
 
wood burning stoves
 
subject: To display XSL-FO content on a browser
 
Similar Threads
How to get fo tags reconized?
fop: xml + xsl => pdf in xpdf ok, in acrobat not so. but via ps (xsl => ps => pdf)
XSL FO: forcing page numbers
XML Notes - III
PDF file contents of word document using XSLT.