Saturday, October 09, 2004

XML Woes

XML is a lot of work, especially when working with XLS-FO within XLS stylesheets. XLS-FO scares me, so I'll stick with the old CSS-based XSL files. Here's a bit of XLS-FO:

Due to some problems with the <pre> tag, I had to rid of the whitespace here. Sorry for the inconveniance.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

<xsl:template match="itemA">
<fo:block
font-size="20pt" font-family="Times New Roman" font-color="black"
space-before="1cm" space-after="1cm">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="list">
<xsl:sort select="num" />
<fo:list-block>
<xsl:choose>
<xsl:when test="num < 10">
<fo:list-item>
<fo:list-item-label>
<fo:block>1.</fo:block>
</fo:list-item-label>
<fo:list-item-body>
<fo:block><xsl:value-of select="test" /></fo:block>
</fo:list-item-body>
</fo:list-item>
<fo:list-item>
<fo:list-item-label>
<fo:block>2.</fo:block>
</fo:list-item-label>
<fo:list-item-body>
<fo:block><xsl:value-of select="texst" /></fo:block>
</fo:list-item-body>
</fo:list-item>
<fo:list-item>
<fo:list-item-label>
<fo:block>3.</fo:block>
</fo:list-item-label>
<fo:list-item-body>
<fo:block><xsl:value-of select="num" /></fo:block>
</fo:list-item-body>
</fo:list-item>
</xsl:when>
<xsl:otherwise>
<fo:list-item>
<fo:list-item-label>
<fo:block font-color="green">1.</fo:block>
</fo:list-item-label>
<fo:list-item-body>
<fo:block font-color="green"><xsl:value-of select="test" /></fo:block>
</fo:list-item-body>
</fo:list-item>
<fo:list-item>
<fo:list-item-label>
<fo:block font-color="green">2.</fo:block>
</fo:list-item-label>
<fo:list-item-body>
<fo:block font-color="green"><xsl:value-of select="texst" /></fo:block>
</fo:list-item-body>
</fo:list-item>
<fo:list-item>
<fo:list-item-label>
<fo:block font-color="green">3.</fo:block>
</fo:list-item-label>
<fo:list-item-body>
<fo:block font-color="green"><xsl:value-of select="num" /></fo:block>
</fo:list-item-body>
</fo:list-item>
</xsl:otherwise>
</xsl:choose>
</fo:list-block>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="result">
<fo:block font-color="red">
<xsl:value-of select="sum(//num))" />
</fo:block>
</xsl:template>
</fo:root>
</xsl:stylesheet>

Beware of XSL-FO.

じゃあ また,

建治宮元ケンジミヤモトTux

0 Comments:

Post a Comment

<< Home


Click Here