Re: Fopping 1-12 to Jan-Dec
First, a thank youz to Jarno, his code worked. I managed to figure out I needed to add number() so that October (10) did not come out as January. Jeni Tennison's code worked too. XSLT Goddess Jeni Tennison emailed me: [updated for my XML DB] [Kay's pg 95 code], as it describes, that code will only work if you're using XSLT 1.1 (or XSLT 2.0 actually) because it silently converts a result tree fragment into a node tree. You will have to use an extension node-set() function, e.g.: xsl:variable name=months-rtf January/February/March/April/May/June/July/ August/September/October/November/December/ /xsl:variable xsl:variable name=months select=xalan:nodeset($months-rtf)/* / xsl:template match=Product/ProductStatus xsl:variable name=mmselect=substring(@statusDateTime,6,2) / xsl:value-of select=name($months[position()=$mm])/ xsl:text /xsl:text xsl:value-of select=number(substring(@statusDateTime,9,2))/ xsl:text, /xsl:text xsl:value-of select=substring(@statusDateTime, 1, 4)/ /xsl:template Result: October 18, 2002 I've posted my thesis that FOP error message reporting should not use dump tracebacks. Now I'd like to say: Please upgrade the Xalan in FOP to be the latest, because it includes EXSLT. Not having EXSLT available during a FOP is like not having CPAN available for PERL. Wheel... http://xml.apache.org/xalan-j/index.html # # Xalan-Java version 2.4.0 also introduces # support for EXSLT extensions. Although I am running FOP from the command-line during development, production use is on the TomCat server I setup. That uses FopServlet.java to run the FOP. I don't know Java to rewrite FopServlet to run a new Xalan (to have EXSLT) then a pure FOP, and so far the only recommendation from this list on plugging a new Xalan into FOP is Don't go there. As for EXSLT, the sooner it's in FOP the better. It's going to happen anyway, right? How about now? (Java style) Regular expressions, etc., in EXSLT. Not to mention the 1-12 month name conversion. Common tasks, needed again and again. We're not writing books here, but processing financial reports on companies into PDFs of several pages from an XML delivery from the clients. EXSLT.org # #Modules # #Dates and Times # #Dynamic # #Common # #Functions # #Math # #Regular Expressions # #Sets # #Strings - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Fopping 1-12 to Jan-Dec
WHAT'S THIS? I DIDN'T WRITE THIS MESSAGE! Is there something wrong with the server or is this just a sick joke? Guy - Original Message - From: [EMAIL PROTECTED] Sent: Monday, October 28, 2002 11:05 AM Subject: Fopping 1-12 to Jan-Dec All I wanted to do was convert a month number 1-12 to month name. I have the Beginning XSLT Wrox book, and Kay's XSLT 2nd Ed. I'm enthused about learning this stuff, and yet there are some major turnoffs being encountered. Generating documents with FOP is what I'm trying to do. I know TeX, so the XSL:FO is not too strange. I have the ORA book for XSL:FO. 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. Polemic I'd like to say how utterly disgusted I am at the error messages coming out of my XSLT (FOP) compiles/transformations. Kay's book erroneously shows that last line above as: xsl:value-of select=name($months/*[position()=$mm / FYI, his Wrox book's errata page is 404. When I have the erroneous line in the source, I get over 800 lines of error messages. What, did a 12-yo kid write XSLT-FOP? For bleep's sake get a hold of a professional compiler writer and put in the necessary structures for normal error msgs. Can you imagine the outcry if GNU's gcc did the same thing when one line of code had a syntax error? Apparently I have to type in a few lines of code and see if it compiles before entering more code, because otherwise there's no way to figure out what's wrong! As in, 'The error messages are so bad I have to resort to commenting out code just to have a freakin' clue as to where I went wrong.' What kind of way to develop is that? Yes, I recognize this as Java-style throwing an exception, or in this case, FOPException(). Not an excuse. No, I am not volunteering my time, and I can't code Java. Recently I came up to speed on perl, compiled 8.0 on my Sun SPARC Solaris 8 boxen, and found perl even has a verbose error message mode that will give you a paragraph or two on what the error msg (always for a given line#) might be about and how to fix. Sometimes FOP doesn't even cough up a line number. FOP's non-existent implementation of error reporting is wasting a lot of programmer time and no doubt retards its use. It should be a top priority for upgrading. /Polemic A newbie hunting and pecking through books and Google results... 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? I downloaded date.zip from exslt.org and added it to the stylesheet declaration, and an 'xsl:import'. Now it says it can't find a string padding function. Hunt...okay, downloaded and unzipped the 'str.zip' deal. Updated the source...damn, same error. Apparently the 'date' routines are referring to the 'str' routines underneath the 'date' subdir 'functions.' Okay, I tar the 'str' functions directory to overlay the 'date' one. Nogo. Gave up this approach. Hmmm, the web pages say the newest 'xalan' has EXSLT built-in. Can I load its jars into the FOP lib directory and get them? http://xml.apache.org/fop/relnotes.html FOP 0.20.4 * FOP should now work with any JAXP1.1 compliant parser/transformer. It has been successfully tested with Xerces/Xalan, Saxon and JDK1.4 (which includes Crimson and Xalan). * The following JARs have been updated: Xerces to version 2.0.1, Xalan to version 2.3.1 and Batik to version 1.5beta2. Maybe? Downloading 'xalan-j_2_4_0-bin.tar.gz' from http://xml.apache.org/xalan-j/index.html. Gunzip, no problem. But the untar... x xalan-j_2_4_0/docs/apidocs/org/apache/xalan/transformer/class-use/Transforme rImpl.html, 55055 bytes, 108 tape blocks tar: directory checksum error Just fabulous. I successfully do the zip version, backup FOP/lib, delete x*, move in xalan's jars [ERROR] null Tweak...tweak... java.lang.NullPointerException I'm stuck. Have I mentioned: All I wanted to do was convert a month number 1-12 to month name. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe,
RE: Fopping 1-12 to Jan-Dec
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 monthJanuary/month monthFebruary/month monthMarch/month monthApril/month monthMay/month monthJune/month monthJuly/month monthAugust/month monthSeptember/month monthOctober/month monthNovember/month monthDecember/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]
Re: Fopping 1-12 to Jan-Dec
On Mon, 2002-10-28 at 11:18, Guy D'haenens wrote: WHAT'S THIS? I DIDN'T WRITE THIS MESSAGE! Is there something wrong with the server or is this just a sick joke? Guy Seems someone is trying to be funny. It looks like it is mailed from (forged) each address on the mailing list and to each address, it is not actually a message on the mailing list (I think). I this person wants to write a polite message and own up who it is then someone should reply. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Fopping 1-12 to Jan-Dec
On Monday 28 October 2002 11:18, Guy D'haenens wrote: WHAT'S THIS? I DIDN'T WRITE THIS MESSAGE! I think the from: address is such that it is being rewritten by some part of your mail system before delivery, it happened here too. If you look at http://marc.theaimsgroup.com/?l=fop-devm=103579950332696w=2 you'll see that the from: address is different of what you got. Don't feed the trolls... -Bertrand - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Fopping 1-12 to Jan-Dec
The re-writing of the email addresses was unintentional, done by the list's software, and I had no idea it was there to trigger. But it is my fault. My normal sending of email isn't from my home boxen, but through a web form. I pop email down to read. Unfortunately, the web form also attaches a reply-to [EMAIL PROTECTED], which is the account I logged into for getting the webmail form, regardless of my putting [EMAIL PROTECTED] in the From: HTML form entry box. This web form behaviour interfered with my subscribing to the list a couple months ago, and it also causes my messages to be blocked for some reason. So I sent the message in question by a direct telnet to port SMTP and some X-Windows scooping. I entered the envelope info, but apparently it would be good to repeat it again in the inside headers, so as not to trigger that TROLL. In reply to Jarno, thanks, I'll try the 'months' solution next waking spell. Jarno wrote: #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. I said the line was erroneous, and that that one line triggered all the error msgs. Without it, no error msgs. I take it you agree, but wish to state it in different terms. However, could you or someone else tell me in a clearer fashion how I can run my FOP and have the ESXLT functions available as native, i.e. no import needed. Thank youz. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]