RE: breaking paragraphs and lines
Processing xml as text is kinda dangerous, especially when you are trying to fiddle with tags, I believe a better and more safe way is to handle \n\n stuff one stage earlier - during fo generation, that's pretty simple in xslt to tokenize string into blocks by any delimiter, trivial recursive template can do that. Very cool. I'm really surprised to see how powerful, though arcane, XSLT is. I naively thought that since I can't write imperatively, it's not a programming language, and if something isn't in the XSL spec, it's hard/impossible to do. But with the hint of the tokenizing stuff be trivial, I took the initiative I should have had before and found some 3rd libraries/algorithms to do the \n\n - fo:block/ conversion. Nice. content This is a long line that I want brokenbr/here. /content Search in the archive - that's faq, you can use either block/ or unicode line separator (#x2028;). Egads. Sorry for not following the best practice of searching the archives. This little topic of breaking is mentioned all over the place. xsl:template match=br xsl:text disable-output-escaping=yes lt;/fo:blockgt; lt;fo:blockgt; /xsl:text /xsl:template Wrong way, disable-output-escaping implies serialization of a result tree hence doesn't work otherwise, e.g. in mozilla, cocoon and fop. This facility is for generating text (e.g. SQL), but not markup. Huh. Interesting. Thanks for all the great information, things are going much smoother now. And sorry for not doing my homework first; I really should have known better. - Stephen
RE: Quark workflow
A better way would probably be to transform QuarkXML to DocBook. There is a wide support for DocBook to PDF conversion and we all read somewhere how easy it is to transform one XML format into another :-) Framemaker actually can work with DocBook, though I have not tried it out. Stephan -Original Message- From: Oleg Tkachenko [mailto:[EMAIL PROTECTED] Sent: Dienstag, 5. November 2002 21:28 To: [EMAIL PROTECTED] Subject: Re: Quark workflow Joel Gwynn wrote: Quark template - Quark XML - [???] - FOP - PDF How do I get from Quark XML to XSL-FO. Well, there is no magic here, Quark XML can be transformed into xsl-fo as any other xml using XSL Transormations language. Learn Quark XML syntax and semantics, develop such a stylesheet and many people will thank you. -- Oleg Tkachenko eXperanto team Multiconn Technologies, Israel
Re: Root element must be root, not (none):glossary
Hi, On Tue, 5 Nov 2002, J.Pietschmann wrote: Deon van der Merwe wrote: org.apache.fop.apps.FOPException: Root element must be root, not (none):glossary at org.apache.fop.fo.FOTreeBuilder.startElement(Unknown Source) at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:575) at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1488) ^^^ This may be the problem. The Crimson parser is said to not implementing namespace support. Check your CLASSPATH environment variable and remove jars like parser.jar or crimson.jar. If there is no such jar, or the problem persists, check Tomcat's lib directory, the startup options, the startup script and perhaps your WEB-INF/lib as well. Right on the nose! Thanks allot.
Showing FO output
In order to debug some code, I would like to see the result of the XML+XSLT tranformation, not the result of the rendering. Can I make FOP do this? Leif Frederiksen
Re: incrementing variable
Phil Dickinson wrote: John is right about not being able to change variables and I think that in order to achieve the effect you want, you should consider using some Java code inside your XSL. Well, extensions are especially good as last resort, but incrementing variables in a side effect free langauge like xslt sounds very ugly. I wouldn't suggest people to go this way, but instead to stop thinking procedurally and to start using real power of xslt. -- Oleg Tkachenko eXperanto team Multiconn Technologies, Israel
Re: Showing FO output
Leif Frederiksen wrote: In order to debug some code, I would like to see the result of the XML+XSLT tranformation, not the result of the rendering. Can I make FOP do this? Actually FOP processes exactly xsl-fo, not xml+xslt, so what you need is not FOP, but usual xslt processor. -- Oleg Tkachenko eXperanto team Multiconn Technologies, Israel
Re: Showing FO output
Leif Frederiksen wrote: In order to debug some code, I would like to see the result of the XML+XSLT tranformation, not the result of the rendering. Can I make FOP do this? btw, I was thinking about implementing such a functionality (view fo source) in FOP's awt viewer, but I was not sure anybody need it, so I left that idea. What are FOP users opinions, is it needed? -- Oleg Tkachenko eXperanto team Multiconn Technologies, Israel
RE: Showing FO output
I think it would be great to have an option to output fo source directly from fop. That way users would not have to script wrap both fop and xalan. Leif Frederiksen -Original Message- From: Oleg Tkachenko [mailto:[EMAIL PROTECTED] Sent: 6. november 2002 13:57 To: [EMAIL PROTECTED] Subject: Re: Showing FO output Leif Frederiksen wrote: In order to debug some code, I would like to see the result of the XML+XSLT tranformation, not the result of the rendering. Can I make FOP do this? btw, I was thinking about implementing such a functionality (view fo source) in FOP's awt viewer, but I was not sure anybody need it, so I left that idea. What are FOP users opinions, is it needed? -- Oleg Tkachenko eXperanto team Multiconn Technologies, Israel
Re: incrementing variable
As my xml file is before traited by a java program in odrer generate other tag. This one will completely generate tag for creating barrecode so before : xml file : barrcecode012341223/barrcode but impossible to realise the svg barrce code after : xml fil after transformation by java programm barrecode number1123412134121134211231412134242411/numbersvg height="50pt" width="400pt"/rec width="1.5" x="4.0"/rec width="1.5" x="7.0"/rec width="1.5" x="10.0"/rec width="1.5" x="14.5"/rec width="1.5" x="100"/ ... /barrcode xsl file : fo:instream-foreign-objectxsl:variable name="w" select="codebarre/svg/@width"/xsl:variable name="h" select="codebarre/svg/@height"/ svg xmlns="http://www.w3.org/2000/svg" width="{$w}" height="{$h}" x="0"g id="codebarre" fill="#00"xsl:for-each select="codebarre/rec"xsl:variable name="w" select="@width"/xsl:variable name="x" select="@x"/rect x="{$x}" width="{$w}" height="50"//xsl:for-each/g/svg/fo:instream-foreign-object Xavier GibouinAxonieEspace Mercoeur8, rue Mercoeur44000 Nantes02.40.48.53.23[EMAIL PROTECTED] - Original Message - From: Oleg Tkachenko To: [EMAIL PROTECTED] Sent: Wednesday, November 06, 2002 1:45 PM Subject: Re: incrementing variable Phil Dickinson wrote: John is right about not being able to change variables and I think that in order to achieve the effect you want, you should consider using some Java code inside your XSL.Well, extensions are especially good as last resort, but incrementing variables in a side effect free langauge like xslt sounds very ugly. I wouldn't suggest people to go this way, but instead to stop thinking procedurally and to start using real power of xslt.-- Oleg TkachenkoeXperanto teamMulticonn Technologies, Israel
line before footnote area
Hi, I am trying to add a line between the main-reference-area and the footnote-reference-area. Has anybody an idea how to do this? Greetings, Marko
Re: Showing FO output
I think having the ability to view the FO source would be both very helpful for debugging and also great for learning what is going on. My $0.02 Bob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 06, 2002 7:57 AM To: [EMAIL PROTECTED] Subject: Re: Showing FO output Leif Frederiksen wrote: In order to debug some code, I would like to see the result of the XML+XSLT tranformation, not the result of the rendering. Can I make FOP do this? btw, I was thinking about implementing such a functionality (view fo source) in FOP's awt viewer, but I was not sure anybody need it, so I left that idea. What are FOP users opinions, is it needed? -- Oleg Tkachenko eXperanto team Multiconn Technologies, Israel
Re: How to show PDF file in jsp page II.
I tried it , it works, but I have one great suspicion: Will it work even on remote server ? response.sendRedirect(outPDF); // outPDF is C:/Program Files/Apache Tomcat 4.0/Fop/TMP.PDF I have Tomcat and browser on one PC . Doesn't the browser thus open the PDF file directly, bypassing Tomcat ? If so, I think I should use URL as parameter. But how can I find out http address from inside the servlet? Thanks for any comments. [EMAIL PROTECTED] wrote: Yesterday, after a few good advices there from fop users I successfuly used this code to show pdf content in browser. It works in my JDeveloper 9i. File inputFile = new File(pdfFile); FileReader fr = new FileReader(inputFile); ByteArrayOutputStream baos = new ByteArrayOutputStream(); int ch; while((ch = fr.read()) != -1) { baos.write(ch); } byte[] content = baos.toByteArray(); response.setContentType(application/pdf); response.setContentLength(content.length); response.getOutputStream().write(content); response.getOutputStream().flush(); Looks too convolute to me. If you have already created pdf file on a disk, why do you process it by hands instead of rely on a web server? Just redirect browser to the file, that will emulate reading static pdf, which works okay even in IE (well, at least if extension is pdf). I mean response.sendRedirect(/foo/bar.pdf); -- Oleg Tkachenko eXperanto team Multiconn Technologies, Israel
Re: How to show PDF file in jsp page II.
Hi, your PDF file has to be accessible for tomcat, for example: Imagine your web application is stored under %TOMCAT_ROOT%/webapps/yourapp Then your PDF file has to be somewhere in your 'yourapp' directory. It is the same as html pages: you referene them (e.g. in html) with a href=foo.html - relative path. So this link in http://localhost/bla.html will link to http://localhost/foo.html. Try this: put your PDF file under your webapp-root (called 'yourapp' above...) directory. And in your jsp: response.setRedirect(outPDF); // outPDF is TMP.PDF (without c:) // tomcat will look for 'yourapp/TMP.PDF' // If your JSP is e.g. accessible under http://localhost/myjsp.jsp // it will redirect to http://localhost/TMP.PDF which is also // remote accessible (if read access is permitted) I never tried response.setRedirect(), but I think this will work ;-) Marko At 17:05 06.11.2002 +0100, you wrote: I tried it , it works, but I have one great suspicion: Will it work even on remote server ? response.sendRedirect(outPDF); // outPDF is C:/Program Files/Apache Tomcat 4.0/Fop/TMP.PDF I have Tomcat and browser on one PC . Doesn't the browser thus open the PDF file directly, bypassing Tomcat ? If so, I think I should use URL as parameter. But how can I find out http address from inside the servlet? Thanks for any comments. [EMAIL PROTECTED] wrote: Yesterday, after a few good advices there from fop users I successfuly used this code to show pdf content in browser. It works in my JDeveloper 9i. File inputFile = new File(pdfFile); FileReader fr = new FileReader(inputFile); ByteArrayOutputStream baos = new ByteArrayOutputStream(); int ch; while((ch = fr.read()) != -1) { baos.write(ch); } byte[] content = baos.toByteArray(); response.setContentType(application/pdf); response.setContentLength(content.length); response.getOutputStream().write(content); response.getOutputStream().flush(); Looks too convolute to me. If you have already created pdf file on a disk, why do you process it by hands instead of rely on a web server? Just redirect browser to the file, that will emulate reading static pdf, which works okay even in IE (well, at least if extension is pdf). I mean response.sendRedirect(/foo/bar.pdf); -- Oleg Tkachenko eXperanto team Multiconn Technologies, Israel
Re: How to show PDF file in jsp page II.
[EMAIL PROTECTED] wrote: I tried it , it works, but I have one great suspicion: Will it work even on remote server ? Why not? Just make sure you save it in a place browser has access to. -- Oleg Tkachenko eXperanto team Multiconn Technologies, Israel
Losing Browser Session when Acrobat Plugin fails
Here's my problem, Scenario I'm trying to send a PDF document, which has been rendered with FOP back to the client through ServletOutputStream. I'm generating a set of XML files that I then render into a PDF document and store the document onto the file system. I then read in the file as a Byte Array and write this to the ServletOutputStream. Issue Sometimes I'm getting the File does not begin with '%PDF-' error message from Acrobat Reader. I've put a dummy .pdf at the end of the URL to fool IE but sometimes I still get the '%PDF-' error. When this happens the browsers session is lost and the user will have to go back to login screen. In this case, if the user tries again to view the PDF, the session is killed straight away, the only way to get it to work again is to go into Task Manager in Windows and kill the AcroRd32.exe process and the iexplore.exe process. If I don't kill the processes, then every time I attemped to launch the Acrobat plugin my session is invalidated. Has anyone else come across this problem? Environment Server IBM Websphere 3.5.5 running on AIX servers. Client Internet Explorer 5.5, Adobe 5.05 on Win2k regards Jonathan == Jonathan McDonald - E-Business Web Development Honeywell Application Services (Ireland) Phone +353 51 309824 Fax:+ 353 51 309821 E-mail: [EMAIL PROTECTED]
Re: line before footnote area
Marko Petersen wrote: I am trying to add a line between the main-reference-area and the footnote-reference-area. Has anybody an idea how to do this? Well, you certanly know what the first footnote body is, so you can just add block with an rule leader at the beginning. See Dave Pawson's example: http://www.dpawson.co.uk/xsl/sect3/bk/ch11.html#d0e8692 -- Oleg Tkachenko eXperanto team Multiconn Technologies, Israel
Re: Losing Browser Session when Acrobat Plugin fails
Hi, maybe you should call your servlet with the option target=blank, for example: a href=/MyServlet target=_blankPDF/a This causes your Servlet output to appear in a new browser window - the old one is still there and should have the valid session. This only helps to hold the session, I think your problem still is the '%PDF-' error and Acrobat, but for this problem: don't know :-( Marko At 17:03 06.11.2002 +0100, you wrote: Here's my problem, Scenario I'm trying to send a PDF document, which has been rendered with FOP back to the client through ServletOutputStream. I'm generating a set of XML files that I then render into a PDF document and store the document onto the file system. I then read in the file as a Byte Array and write this to the ServletOutputStream. Issue Sometimes I'm getting the File does not begin with '%PDF-' error message from Acrobat Reader. I've put a dummy .pdf at the end of the URL to fool IE but sometimes I still get the '%PDF-' error. When this happens the browsers session is lost and the user will have to go back to login screen. In this case, if the user tries again to view the PDF, the session is killed straight away, the only way to get it to work again is to go into Task Manager in Windows and kill the AcroRd32.exe process and the iexplore.exe process. If I don't kill the processes, then every time I attemped to launch the Acrobat plugin my session is invalidated. Has anyone else come across this problem? Environment Server IBM Websphere 3.5.5 running on AIX servers. Client Internet Explorer 5.5, Adobe 5.05 on Win2k regards Jonathan == Jonathan McDonald - E-Business Web Development Honeywell Application Services (Ireland) Phone +353 51 309824 Fax:+ 353 51 309821 E-mail: [EMAIL PROTECTED]
Re: line before footnote area
Yes, I know the first footnote body of the document, but I have to know each footnote body, which is the first displayed on one page. This one should have a line above, the others at the same page should not. Is there a way to get this node? Thanks, Marko At 18:18 06.11.2002 +0200, you wrote: Marko Petersen wrote: I am trying to add a line between the main-reference-area and the footnote-reference-area. Has anybody an idea how to do this? Well, you certanly know what the first footnote body is, so you can just add block with an rule leader at the beginning. See Dave Pawson's example: http://www.dpawson.co.uk/xsl/sect3/bk/ch11.html#d0e8692 -- Oleg Tkachenko eXperanto team Multiconn Technologies, Israel
HTML+CSS - XSL:FO
Sorry for asking a question which I know is already in my FAQ but I have a colleague who needs to render HTML *with* CSS to PDF. I am wondering whether we have anything like a web browser which outputs XSL:FO yet. Does anyone use one? My instant reaction is to say convert to XML instead of HTML, but the data is already in HTML and the CSS is important. Maybe we should enhance the Mozilla rendering engine to output XSL:FO ? Alex PS http://www.OWAL.co.uk/cgi-bin/fopfaq.cgi Openweb Analysts Ltd, London. Software For Complex Websites http://www.OWAL.co.uk/ Open Source Software Companies please register here http://www.OWAL.co.uk/oss_support/
RE: Quark workflow
So, to continue down this winding road a little further ... Quark seems to produce three documents: a css, dtd, and xml. The goal is to produce an xsl file that can transform the xml to xsl-fo. Should I be writing a script that takes that dtd and css and produces an xsl file? Would it be possible to write an xsl file that can read the dtd, css, and xml and produce the xsl-fo file? Sorry if it sounds like I'm flailing. I am. Joel Gwynn Variable Data Spire 617 832-1957 -Original Message- From: Oleg Tkachenko [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 3:28 PM To: [EMAIL PROTECTED] Subject: Re: Quark workflow Joel Gwynn wrote: Quark template - Quark XML - [???] - FOP - PDF How do I get from Quark XML to XSL-FO. Well, there is no magic here, Quark XML can be transformed into xsl-fo as any other xml using XSL Transormations language. Learn Quark XML syntax and semantics, develop such a stylesheet and many people will thank you. -- Oleg Tkachenko eXperanto team Multiconn Technologies, Israel
Re: HTML+CSS - XSL:FO
On Wednesday 06 November 2002 18:31, Alex McLintock wrote: Sorry for asking a question which I know is already in my FAQ but I have a colleague who needs to render HTML *with* CSS to PDF. I hope this is not the FAQ answer ;-) Assuming client-side is ok (or you want to try to automate these functions), I see two possibilities: a) print to PostScript or PDF from a browser b) import the pages to Acrobat (Windows version does it nicely, I think including CSS) and save as PDF -Bertrand
Re: Quark workflow
Joel Gwynn wrote: So, to continue down this winding road a little further ... Quark seems to produce three documents: a css, dtd, and xml. What are in them? The goal is to produce an xsl file that can transform the xml to xsl-fo. Should I be writing a script that takes that dtd and css and produces an xsl file? Don't forget xml :) Would it be possible to write an xsl file that can read the dtd, css, and xml and produce the xsl-fo file? No, xslt processor needs xml (dtd is for parser) as input, but there are a lot of tricks. Details greatly depend on what is in those files and how they are interconnected. -- Oleg Tkachenko eXperanto team Multiconn Technologies, Israel
RE: Quark workflow
-Original Message- From: Oleg Tkachenko [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 06, 2002 12:45 PM To: [EMAIL PROTECTED] Subject: Re: Quark workflow Joel Gwynn wrote: So, to continue down this winding road a little further ... Quark seems to produce three documents: a css, dtd, and xml. What are in them? The goal is to produce an xsl file that can transform the xml to xsl-fo. Should I be writing a script that takes that dtd and css and produces an xsl file? Don't forget xml :) Would it be possible to write an xsl file that can read the dtd, css, and xml and produce the xsl-fo file? No, xslt processor needs xml (dtd is for parser) as input, but there are a lot of tricks. Details greatly depend on what is in those files and how they are interconnected. -- Oleg Tkachenko eXperanto team Multiconn Technologies, Israel Well, since you asked ... I uploaded the files to my server for perusal, just in case you're interested. These are the files from the quark.avenue tutorial. http://joelman.com/avenue-xml/ I'll probably have to take them down eventually, but if you wanted to take a look and offer suggestions, I'd be hugely appreciative.
Re: incrementing variable
xavier gibouin wrote: As my xml file is before traited by a java program in odrer generate other tag. This one will completely generate tag for creating barrecode so If you want to generate SVG barcodes, why don't you use the barcode XSL form RenderX? http://www.renderx.com/barcodes.html J.Pietschmann
Re: Quark workflow
Joel Gwynn wrote: Well, since you asked ... I uploaded the files to my server for perusal, just in case you're interested. These are the files from the quark.avenue tutorial. http://joelman.com/avenue-xml/ Well that's not a bad format, xml + css, but unfortunaly css in not xml hence one can say it's browser oriented format. If you want to process it by xslt the main burden is css parsing. I developed such stuff recently, but that was for a commercial project and I cannot share the code. The main idea is to write URIResolver, which reads css file, parses it somehow, e.g. using w3c's SAC (Simple API for CSS) and represents css in xml format, e.g. each selector is element and each propery is its attribute. Then you can use such URIResolver from within xsl stylesheet and generate xsl-fo attributes from css properties (they happily almost coincide). I mean xml head_L1avenue.quark White Paper/head_L1 css head_L1 { font-size : 18pt; font-family : Arial; font-weight : Bold; color : Blue; background-color : Aqua; display : block; line-height : 40pt; } xsl: xsl:template match=head_L1 fo:block xsl:copy-of select=document('css:my-css-name')/head_L1/@*/ xsl:apply-templates/ /fo:block /xsl:template result: fo:block font-size=18pt font-family=Arial font-weight=Bold color=Blue background-color=Aqua display=block line-height=40pt ...content... /fo:block It's feasible but requires a lot of careful work. I'd suggest you to look around for another quark export tool, which doesn't use css but pure xml, that would be big relief, e.g. google pointed out to http://www.attd.com. -- Oleg Tkachenko eXperanto team Multiconn Technologies, Israel
Repeating table headers accross pages
Hi, how would I get table headers to repeat across pages using FOP? Thanks! Jonathan Evraire jonevrai at justice.gc.ca
RE: Repeating table headers accross pages
Set table attribute table-omit-header-at-break=false. -Original Message- From: Evraire, Jonathan [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 06, 2002 1:55 PM To: '[EMAIL PROTECTED]' Subject: Repeating table headers accross pages Hi, how would I get table headers to repeat across pages using FOP? Thanks! Jonathan Evraire jonevrai at justice.gc.ca This electronic transmission is strictly confidential to Smith Nephew and intended solely for the addressee. It may contain information which is covered by legal, professional or other privilege. If you are not the intended addressee, or someone authorized by the intended addressee to receive transmissions on behalf of the addressee, you must not retain, disclose in any form, copy or take any action in reliance on this transmission. If you have received this transmission in error, please notify the sender as soon as possible and destroy this message.
Re: line before footnote area
Marko Petersen wrote: I am trying to add a line between the main-reference-area and the footnote-reference-area. Has anybody an idea how to do this? The spec provides a special region named xsl-footnote-separator for this purpose, you could put a leader in it: fo:static-content flow-name=xsl-footnote-separator fo:blockfo:leader leader-pattern=rule//fo:block /fo:static-content Unfortunately, FOP does not implement this. IOW you're hosed. If you are adventurous, check out the area tree output (aka XML output). You might be able to automatically leverage this to determine which footnotes are the first on a page, and then do a second XSLT/rendering pass, using this information to insert a leader in the footnote-body of said footnotes. J.Pietschmann
Re: Showing FO output
Jeremias Maerki wrote: I'm going a step further and I'm thinking about providing a development tool for FOP. I'm looking forward to this. For the subject at hand, however, I think a fop -xml foo.xml -xsl foo.xsl -fo foo.fo would do, and I hope I can get this even in the next maintenance release. J.Pietschmann
Re: Showing FO output
I am often generating .fo files with XML::Sablotron, and find it very useful to examine the source when things are not going as expected. -Carl Holm [EMAIL PROTECTED] wrote: I think having the ability to view the FO source would be both very helpful for debugging and also great for learning what is going on. My $0.02 Bob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 06, 2002 7:57 AM To: [EMAIL PROTECTED] Subject: Re: Showing FO output Leif Frederiksen wrote: In order to debug some code, I would like to see the result of the XML+XSLT tranformation, not the result of the rendering. Can I make FOP do this? btw, I was thinking about implementing such a functionality (view fo source) in FOP's awt viewer, but I was not sure anybody need it, so I left that idea. What are FOP users opinions, is it needed? -- Oleg Tkachenko eXperanto team Multiconn Technologies, Israel