XSL-FO and XSLT

« Previous Chapter Next Chapter »

XSL-FO and XSLT can help each other.

Remember this Example?

<fo:block font-size="14pt" font-family="cursive" color="green"
space-before="4mm" space-after="4mm">
  QcTutorials
</fo:block>

<fo:block text-indent="5mm" font-family="cursive" font-size="12pt">
  At QcTutorials you can find most of the tutorials you
  need, from basic HTML and XHTML to advanced PHP, XML, and JAVA.
</fo:block>

Output Will Be :

QcTutorials

   At QcTutorials you can find most of the tutorials you need, from basic HTML and XHTML to advanced PHP, XML, and JAVA.

The example above is from the chapter about XSL-FO Blocks.

With a Little Help from XSLT

Remove the XSL-FO information from the document:

<header>QcTutorials</header>

<paragraph>At QcTutorials you can find most of the tutorials you
need, from basic HTML and XHTML to advanced PHP, XML, and JAVA.
</paragraph>

Add an XSLT transformation:

<xsl:template match="header">
  <fo:block font-size="14pt" font-family="cursive" color="green"
  space-before="4mm" space-after="4mm">
    <xsl:apply-templates/>
  </fo:block>
</xsl:template>

<xsl:template match="paragraph">
  <fo:block text-indent="5mm" font-family="cursive" font-size="12pt">
    <xsl:apply-templates/>
  </fo:block>
</xsl:template>

And the result will be the same:

QcTutorials

   At QcTutorials you can find most of the tutorials you need, from basic HTML and XHTML to advanced PHP, XML, and JAVA.


« Previous Chapter Next Chapter »

Have Any Suggestion? We Are Waiting To Hear from YOU!

Your Query was successfully sent!