Formatting omitted from XSL-FO transformation
Posted: Mon Sep 10, 2007 7:14 pm
I'm attempting to learn XSL-FO by starting completely minimalist: just one simple-page-master, and just one page-sequence. The source file is Docbook 5 CR5.
So, my XSL file begins like this:
Stop me here if there any problems with just that little bit.
Then, I'm adding a few basic XSL template to provide the rest. Practically everything is inside an fo:block for now to reduce visual noise when I look at this weird FO code.
So, the transformation happens, but NONE of my formatting attributes are applied. The following template will output the text content, but not the formatting:
Absolutely none of those attributes appear to have any effect on the output PDF whatsoever. The output is pretty much a bunch of fo:blocks of unstyled text stretching a couple of pages, and that's it. I mean, I expected a pretty dull output from my very spartan stylesheet, but I would have expected at least some simple formatting attributes to at least make the titles stand out from the content. This is not the case.
This irritates the hell out of me since I'm extremely comfortable with CSS, and it appeared that these are almost direct maps of CSS properties. In the middle of all this weird FO code, these formatting attributes were the one thing I found something of a familiar face in...and they aren't working!
Grr.
Does anybody know why this is?
So, my XSL file begins like this:
Code: Select all
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<!--
defines templates describing high-level page layout only
-->
<fo:layout-master-set>
<fo:simple-page-master master-name="default">
<fo:region-body />
</fo:simple-page-master>
</fo:layout-master-set>
<!--
references page layouts defined in /fo:layout-master-set and
adds specifics
-->
<fo:page-sequence master-reference="default">
<fo:flow flow-name="xsl-region-body">
<xsl:apply-templates />
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
Then, I'm adding a few basic XSL template to provide the rest. Practically everything is inside an fo:block for now to reduce visual noise when I look at this weird FO code.

So, the transformation happens, but NONE of my formatting attributes are applied. The following template will output the text content, but not the formatting:
Code: Select all
<xsl:template match="book/title">
<fo:block
space-before="1in"
space-after="1in"
color="#FFAA33"
font-size="1in"
font-family="Skia, 'Myriad Web', Myriad, 'Century Gothic', Arial, sans-serif">
<xsl:apply-templates />
</fo:block>
</xsl:template>
Absolutely none of those attributes appear to have any effect on the output PDF whatsoever. The output is pretty much a bunch of fo:blocks of unstyled text stretching a couple of pages, and that's it. I mean, I expected a pretty dull output from my very spartan stylesheet, but I would have expected at least some simple formatting attributes to at least make the titles stand out from the content. This is not the case.
This irritates the hell out of me since I'm extremely comfortable with CSS, and it appeared that these are almost direct maps of CSS properties. In the middle of all this weird FO code, these formatting attributes were the one thing I found something of a familiar face in...and they aren't working!
Grr.
Does anybody know why this is?