Formatting Objects in XSL

T

toyz

Hi all,
this look like a newbie question but I trying to find a slotion to this
for the past few days. I need to set the print format (margin, page
orientation) of a XSL in such a way that the user will be able to print
the page from the browser in a pre-defined format. I have read about
the XSL Formatting Objects and I am trying to use embedded this object
in the xsl to accomplish this. Is this possible?

Below is the sample XSL stylesheet I am trying for the past few days. I
would really appreciate if anyone can point out to me where have I gone
wrong.

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<xmlns:fo root="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master
margin-right="0cm"
margin-bottom="0cm"
margin-top="0cm"
page-width="29.7cm"
page-height="21cm"
master-name="landscape">
<fo:region-body
margin-right="0cm"
margin-bottom="0cm"
margin-top="0cm"
page-width="29.7cm"
page-height="21cm"
</fo:simple-page-master>
</fo:layout-master-set>
</xmlns:fo>

<html>
<body>
<table width="700" border="1">
<xsl:for-each select="NewDataSet/Table">
<tr height="75">
<td width="350">
<xsl:value-of select="RefNo"/>
<br/>
<xsl:value-of select="Name"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>

</xsl:template>
</xsl:stylesheet>
 
P

Peter Flynn

toyz said:
Hi all,
this look like a newbie question but I trying to find a slotion to this
for the past few days. I need to set the print format (margin, page
orientation) of a XSL in such a way that the user will be able to print
the page from the browser in a pre-defined format. I have read about
the XSL Formatting Objects and I am trying to use embedded this object
in the xsl to accomplish this. Is this possible?

If all you want is to display it in a browser, just use XSLT to
output it with HTML markup and use CSS to guide the formatting.

///Peter
 
J

Joe Kesselman

The classic path is to use XSLT to create XSL Formatting Object markup,
then run that through an XSL-FO processor (such as Apache's FOP) to get
the presentation-ready rendering (eg PDF). You then deliver that
rendered file to the user.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top