Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

XSL-FO and XSLT


May 28, 2021 XSL-FO


Table of contents


XSL-FO and XSLT


This section describes the relationship between XSL-FO and XSLT.

XSL-FO and XSLT can help each other.


Remember this example?

<fo:block font-size="14pt" font-family="verdana" color="red"
space-before="5mm" space-after="5mm">
W3CSchool
</fo:block>

<fo:block text-indent="5mm" font-family="verdana" font-size="12pt">
At W3CSchool you will find all the Web-building tutorials you
need, from basic HTML and XHTML to advanced XML, XSL, Multimedia and WAP.
</fo:block>

Results:

W3CSchool

At W3CSchool you will find all the Web-building tutorials you need, from basic HTML and XHTML to advanced XML, XSL, Multimedia and WAP.

The example above comes from the section on the XSL-FO block area.


Help from XSLT

Remove XSL-FO information from the document:

<header>W3CSchool</header>

<paragraph>At W3CSchool you will find all the Web-building tutorials you
need, from basic HTML and XHTML to advanced XML, XSL, Multimedia and WAP.
</paragraph>

Add an XSLT conversion:

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

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

The result is the same:

W3CSchool

At W3CSchool you will find all the Web-building tutorials you need, from basic HTML and XHTML to advanced XML, XSL, Multimedia and WAP.

That's how XSL-FO and XSLT are covered.

Related tutorials

XSLT tutorial