Hi, > All I wanted to do was convert a month number 1-12 to month name.
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:foo="http://foo.com"> <xsl:template match="/"> ... <xsl:variable name="the-month-number" select="2" /> ... <xsl:value-of select="$months[$the-month-number]" /> ... </xsl:template> <xsl:variable name="months" select="document('')/xsl:stylesheet/foo:months/*" /> <foo:months> <month>January</month> <month>February</month> <month>March</month> <month>April</month> <month>May</month> <month>June</month> <month>July</month> <month>August</month> <month>September</month> <month>October</month> <month>November</month> <month>December</month> </foo:months> </xsl:stylesheet> Or write a named template that returns it. [snip] > I've received an XLST-FO source to maintain, and when I > saw the enumerated if-test sequence to choose a month > name from 1-12, I thought, "There's got to be a shorter > way." > > Page 95 of Kay's book: > > <xsl:variable name="months"> > <January/><February/><March/><April/><May/><June/><July/> > <August/><September/><October/><November/><December/> > </xsl:variable> > > <xsl:value-of select="name($months/*[position()=2])" /> > > I've hard-coded February in this example. > Result: [ERROR] No flow found for region-body in page-master 'first' > > The code is in the header part of the document-code, in a > '<fo:static-content...>'. But I tried in a non-static flow, > and tried a template version. Nogo. I would imagine that this error message has nothing to do with the example in Mike's book, but rather with the fact that your stylesheet is not generating valid FO. Also, the example uses XSLT 1.1 (which was never developed to a Recommendation), so you need an XSLT processor that supports XSLT 1.1, i.e. Saxon or jd.xslt. But you don't want to go there. [snip] > I tried xmlns:date="http://exslt.org/dates-and-times", but > that URL is 404. (I emailed Tennison, and also Wrox about > their 404.) > > So, FOP doesn't have EXSLT functions? Because EXSLT has XSLT extensions, not XSL extensions. Cheers, Jarno --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]