Subject: Re: xsl-fo templates for svg
From: JIVA <jiva@xxxxxxx>
Date: Wed, 27 Aug 2008 10:16:31 +0200
|
Quoting Karl Stubsjoen <kstubs@xxxxxxxxx>:
> Is anyone extending xsl-fo with custom xsl/svg templates? For
> example: an xsl template which return text rotated or a template
> which produces pie charts (expressed as svg), etc... I'd be
> interested in what has been done in this area.
A quick and dirty one.
Creates a coloured rounded rectangle with page number.
<xsl:template name="SVG.page.number">
<fo:block-container display-align="center" text-align="center"
width="{$page.width}pt" height="100%">
<fo:block width="{$SVG.button.width}{$measure}"
height="{$SVG.button.height}{$measure}">
<fo:instream-foreign-object>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
width="{$SVG.button.width}{$measure}" height="{$SVG.button.height}{$measure}"
id="svg{generate-id()}" viewBox="0 0 {$SVG.button.width} {$SVG.button.height}">
<rect width="{$SVG.button.width}{$measure}"
height="{$SVG.button.height}{$measure}" rx="10" ry="10" x="0" y="0"
style="opacity:1;fill:#FFD300;fill-opacity:1;" id="rect{generate-id()}"/>
</svg>
</fo:instream-foreign-object>
</fo:block>
</fo:block-container>
<fo:block-container position="absolute" top="0" display-align="center"
text-align="center" width="{$page.width}pt" height="100%">
<fo:block text-align="center" width="{$SVG.button.width}{$measure}"
height="{$SVG.button.height}{$measure}" display-align="center">
<fo:inline color="#000" font-size="12pt" font-family="{$sans-serif}"
font-weight="bold">
<fo:page-number/>
</fo:inline>
</fo:block>
</fo:block-container>
</xsl:template>
--
Jacek Iwanski
|