XSLT
Шрифт:
margin-top="0mm" margin-bottom="10mm"
margin-left="0mm" margin-right="0mm"/>
<fo:region-after extent="10mm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-name="page">
<fo:flow flow-name="xsl-region-body">
<fo:block font-weight="bold" font-size="36pt"
line-height="48pt" font-family="Times" color="blue">
The Planets Table
</fo:block>
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="PLANET/NAME">
<fo:block font-weight="bold" font-size="28pt"
line-height="48pt" font-family="Times"
font-style="italic">
Planet:
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="PLANET/MASS">
<fo:block font-size="24pt" line-height="32pt"
font-family="Times">
<fo:inline text-decoration="underline">
Mass
</fo:inline>:
<xsl:apply-templates/>
[Earth = 1]
</fo:block>
</xsl:template>
<xsl:template match="PLANET/DAY">
<fo:block font-size="24pt" line-height="32pt"
font-family="Times">
<fo:inline text-decoration="underline">
Day
</fo:inline>:
<xsl:apply-templates/>
[Earth = 1]
</fo:block>
</xsl:template>
<xsl:template match="PLANET/RADIUS">
<fo:block font-size="24pt" line-height="32pt"
font-family="Times">
<fo:inline text-decoration="underline">
Radius
</fo:inline>:
<xsl:apply-templates/>
miles
</fo:block>
</xsl:template>
<xsl:template match="PLANET/DENSITY">
<fo:block font-size="24pt" line-height="32pt"
font-family="Times">
<fo:inline text-decoration="underline">
Density
</fo:inline>:
<xsl:apply-templates/>
[Earth = 1]
</fo:block>
</xsl:template>
<xsl:template match="PLANET/DISTANCE">
<fo:block font-size="24pt" line-height="32pt"
font-family="Times">
<fo:inline text-decoration="underline">
Distance
</fo:inline>:
<xsl:apply-templates/>
million miles
</fo:block>
</xsl:template>
</xsl:stylesheet>
После
planets.xsl
будет получен файл planets.fo
, который при помощи форматирующих объектов XSL-FO создает документ с видом, показанным на рис. 11.1. Вот как выглядит planets.fo
(листинг 11.3). Листинг 11.3. planets.fo
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master margin-right="20mm"
margin-left="20mm" margin-bottom="10mm"
margin-top="10mm" page-width="300mm"
page-height="400mm" master-name="page">
<fo:region-body margin-right="0mm" margin-left="0mm"
margin-bottom="10mm" margin-top="0mm"/>
<fo:region-after extent="10mm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-name="page">
<fo:flow flow-name="xsl-region-body">
<fo:block color="blue" font-family="Times"
line-height="48pt" font-size="36pt" font-weight="bold">
The Planets Table
</fo:block>
<fo:block font-style="italic" font-family="Times"
line-height="48pt" font-size="28pt" font-weight="bold">
Planet:
Mercury
</fo:block>
<fo:block font-family="Times" line-height="32pt" font-size="24pt">
<fo:inline text-decoration="underline">
Поделиться с друзьями: