RE: how can I create template for manipulating embedded and exter nal style sheet present in the html page? Is it possible?
Hi mike Thank you for your reply. Thank you.. Actually my problem is i want to convert a web page into PDF. What is my logic is i created one servlet.In that servlet i am reading the content of url(html content).I apply W3C tidy to make it as xhtml.I created an xsl file using xslt and xsl-fo. I created template for all the html 4.0 tags and its working properly.(Some problem with table).Then applying xhtml and xsl to XSLTInputHandler of fop and render it to PDF. My problem is with table only table width=.I created template for width attribute. xsl:attribute-set name=table-structure xsl:attribute name=table-layoutauto/xsl:attribute xsl:attribute name=space-before10pt/xsl:attribute xsl:attribute name=space-after10pt/xsl:attribute /xsl:attribute-set fo:table xsl:use-attribute-sets=table-structure xsl:when test=@width xsl:attribute name=width xsl:call-template name=createwidth/ /xsl:attribute /xsl:when /fo:table But all the time the table will be displayed on the entire page width. suppose we are creating a table with 2 column. In html this will be displayed as a small table (depending upon the table content).But my problem is in PDF it will be displayed in entire page width. How can i solve this problem..Please help me. Following is the overview of my table layout xsl:attribute-set name=table-structure xsl:attribute name=table-layoutauto/xsl:attribute xsl:attribute name=space-before10pt/xsl:attribute xsl:attribute name=space-after10pt/xsl:attribute xsl:attribute name=border-styleoutset/xsl:attribute xsl:attribute name=border-collapseseparate/xsl:attribute xsl:attribute name=border-spacing2px/xsl:attribute /xsl:attribute-set fo:table xsl:use-attribute-sets=table-structure xsl:for-each select=tr[1]/th|tr[1]/td|thead/tr[1]/th|thead/tr[1]/td|tbody/tr[1]/th|tbody /tr[1]/td fo:table-column column-width=proportional-column-width(1)/ /xsl:for-each !--==handle tbody element =-- !--==handle thead element =-- !--==handle tfoot element =-- /fo:table Thanks in advance Cheers george -Original Message- From: Mike Trotman [mailto:[EMAIL PROTECTED] Sent: Monday, September 06, 2004 9:21 PM To: [EMAIL PROTECTED] Subject: Re: how can I create template for manipulating embedded and external style sheet present in the html page? Is it possible? ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ** -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 A quick response as I'm not sure I understand your question - but I think you're saying you can process all the 'inline' style + other attributes in an HTML document - but that you want ot be able to implement CSS class styles in FO-PDF? If so - that is not easy - particularly as CSS - XSL-FO attributes don't always map straightforwardly and some have different names, and detecting precedence, context and dealing with multiple CSS stylesheets is difficult. A useful utility from RenderX which may help you to map equivalent attributes is at http://www.renderx.com/~renderx/portal/fo2html.html. This maps XSLFO - HTML - and does a pretty good job. The way I deal with this problem is to turn the CSS stylesheets into XML documents - and then add attributes for the XSLFO equivalents. The structure of this XML depends on how much of the complexity of CSS you want to capture.) (this document can the be used to produce the CSS stylesheets as well.) I then load this document as a parameter when processing and lookup any formatting for the element / class I am dealing with. (I find this easier than trying to define fixed attribute sets.) With XSL / XML based output formatting it is nearly always easier to have a core XML document from which all other output (including HTML) is generated. If your HTML is well formed XML / XHTML then your task is easier. FOP 0.20.5 does not suppor table-with-caption - and many other processors also do not. FOP 0.20.5 does not support table-layout='auto' (only 'fixed') - and this is also true of many other processors - so I don't know how you are getting the table to fit the width of the page. unless you are specifying that the inline-progression dimension='100%'. Eldho George wrote: | | | Hi, | | | | | | I would like to know *how can I create template for manipulating | embedded and external style sheet present in the html page? Is
RE: Pyjama stripes - for each 5 rows
Hi, You can use a pattern like this: (position() div 5) mod 2 When the result is 0, apply background color #1, When the result is 1, apply background color #2. If you need to know an ancestor element position, you may replace position() with count(ancestor::ref_element/preceding-sibling::ref_element) -- this gives same result as position() - 1 But this looks like an XSLT problem. Ask on the XSL list for better code: http://www.mulberrytech.com/xsl/xsl-list -Message d'origine- De : Avula, Srini [mailto:[EMAIL PROTECTED] Envoyé : lundi 6 septembre 2004 13:59 À : [EMAIL PROTECTED] Objet : Pyjama stripes - for each 5 rows Hi I have long list of students to display for each centre. I would like to change background colour of each 5th row or space between 5 and 6th rows. any ideas how can I do it. Much appreciate your help. Kind Regards Srini - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error while building FOP dev1
Pascal Sancho wrote: snip/ codegen: [echo] Resetting codegen directory [echo] Generating the java files from xml resources [style] Processing D:\cvs\xml-fop\src\codegen\encodings.xml to D:\cvs\xml-fop\build\gensrc\o rg\apache\fop\fonts\CodePointMapping.java [style] Loading stylesheet D:\cvs\xml-fop\src\codegen\code-point-mapping.xsl BUILD FAILED I have just run the build now and it was successful. javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.Tr ansformerFactoryImpl not found Looks like a classpath problem: the build cannot find Xalan. Check your classpath. Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error while building FOP dev1
Chris, have you tried under JDK 1.3? Because Pascal tries to compile under 1.3. Unfortunately, I'm at work on my notebook where I don't have a current FOP HEAD to try. I can check this out this evening. On 07.09.2004 11:26:08 Chris Bowditch wrote: Pascal Sancho wrote: snip/ codegen: [echo] Resetting codegen directory [echo] Generating the java files from xml resources [style] Processing D:\cvs\xml-fop\src\codegen\encodings.xml to D:\cvs\xml-fop\build\gensrc\o rg\apache\fop\fonts\CodePointMapping.java [style] Loading stylesheet D:\cvs\xml-fop\src\codegen\code-point-mapping.xsl BUILD FAILED I have just run the build now and it was successful. javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.Tr ansformerFactoryImpl not found Looks like a classpath problem: the build cannot find Xalan. Check your classpath. Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Error while building FOP dev1
I've copied Xalan from my fop dir to my ant dir, and I get now up to 100 errors (the build limit). Here follows pieces of return. Pascal compile-src: [echo] Compiling the sources [javac] Compiling 293 source files to D:\cvs\xml-fop\build\classes [javac] D:\cvs\xml-fop\src\java\org\apache\fop\fo\FOText.java:134: Undefined variable or class name: WhiteSpaceCollapse [javac] if (textInfo.whiteSpaceCollapse == WhiteSpaceCollapse.FALSE [javac]^ [javac] D:\cvs\xml-fop\src\java\org\apache\fop\fo\FOText.java:197: Undefined variable or class name: TextTransform [javac] if (textInfo.textTransform == TextTransform.NONE) { [javac] ^ [javac] D:\cvs\xml-fop\src\java\org\apache\fop\fo\FOText.java:326: Constant expression required. [javac] case TextTransform.NONE: [javac] ^ [...] [javac] D:\cvs\xml-fop\src\java\org\apache\fop\fo\flow\InstreamForeignObject.java:82: Constant expression required. [javac] case TextAlign.CENTER: [javac] ^ [javac] D:\cvs\xml-fop\src\java\org\apache\fop\fo\flow\InstreamForeignObject.java:82: Undefined variable or class name: TextAlign [javac] case TextAlign.CENTER: [javac] ^ [javac] D:\cvs\xml-fop\src\java\org\apache\fop\fo\flow\Leader.java:72: Constant expression required. [javac] case LeaderPattern.SPACE: [javac] ^ [javac] D:\cvs\xml-fop\src\java\org\apache\fop\fo\flow\Leader.java:72: Undefined variable or class name: LeaderPattern [javac] case LeaderPattern.SPACE: [javac] ^ [...] [javac] D:\cvs\xml-fop\src\java\org\apache\fop\fo\flow\Table.java:96: Undefined variable orclass name: TableLayout [javac] this.bAutoLayout = (getPropEnum(PR_TABLE_LAYOUT) == TableLayout.AUTO); [javac] ^ [javac] D:\cvs\xml-fop\src\java\org\apache\fop\fo\flow\Table.java:99: Undefined variable orclass name: TableOmitHeaderAtBreak [javac] == TableOmitHeaderAtBreak.TRUE; [javac]^ [...] [javac] D:\cvs\xml-fop\src\java\org\apache\fop\fo\flow\TableCell.java:146: Undefined variable or class name: BorderCollapse [javac] bSepBorders = (getPropEnum(PR_BORDER_COLLAPSE) == BorderCollapse.SEPARATE); [javac] ^ [...] [javac] D:\cvs\xml-fop\src\java\org\apache\fop\fo\pagination\ConditionalPageMasterReference.java:110: Undefined variable or class name: PagePosition [javac] if (pagePosition == PagePosition.REST) { [javac] ^ [...] [javac] D:\cvs\xml-fop\src\java\org\apache\fop\fo\pagination\RegionAfter.java:53: Undefined variable or class name: Precedence [javac] precedence = (getPropEnum(PR_PRECEDENCE) == Precedence.TRUE); [javac] ^ [...] [javac] D:\cvs\xml-fop\src\java\org\apache\fop\layoutmgr\BlockContainerLayoutManager.java:77: Undefined variable or class name: AbsolutePosition [javac] if (abProps.absolutePosition == AbsolutePosition.ABSOLUTE) { [javac] ^ [...] [javac] D:\cvs\xml-fop\src\java\org\apache\fop\layoutmgr\CharacterLayoutManager.java:78: Constant expression required. [javac] case VerticalAlign.MIDDLE: [javac] ^ [javac] D:\cvs\xml-fop\src\java\org\apache\fop\layoutmgr\CharacterLayoutManager.java:78: Undefined variable or class name: VerticalAlign [javac] case VerticalAlign.MIDDLE: [javac] ^ [...] [javac] Too many errors. (The limit on reported errors is 100.) [javac] 105 errors BUILD FAILED D:\cvs\xml-fop\build.xml:447: Compile failed; see the compiler error output for details. -Message d'origine- De : Jeremias Maerki [mailto:[EMAIL PROTECTED] Envoyé : mardi 7 septembre 2004 11:39 À : [EMAIL PROTECTED] Objet : Re: Error while building FOP dev1 Chris, have you tried under JDK 1.3? Because Pascal tries to compile under 1.3. Unfortunately, I'm at work on my notebook where I don't have a current FOP HEAD to try. I can check this out this evening. On 07.09.2004 11:26:08 Chris Bowditch wrote: Pascal Sancho wrote: snip/ codegen: [echo] Resetting codegen directory [echo] Generating the java files from xml resources [style] Processing D:\cvs\xml-fop\src\codegen\encodings.xml to D:\cvs\xml-fop\build\gensrc\o rg\apache\fop\fonts\CodePointMapping.java [style] Loading stylesheet D:\cvs\xml-fop\src\codegen\code-point-mapping.xsl BUILD FAILED I have just run the build now and it was successful.
Re: Error while building FOP dev1
Looks like we don't have JDK 1.3 compatibility at the moment. I think I have seen this myself under JDk 1.3 lately. Pascal, please use JDK 1.4 to compile if you really want to take a look at the latest development code. Be aware that the CVS HEAD code is not ready for production. It's only interesting for people who want to follow our developments and/or want to help us improve FOP. The only exception is the SVG transcoder part which is beta-quality. Note to Devs: We should see to it that at least the Transcoders compile again under JDK 1.3 as Batik still depends on it. Unless there is a vote on dropping JDK 1.3 support for the rest I regard the current state as a bug. I may have time this week to have a look at it. On 07.09.2004 13:31:48 Pascal Sancho wrote: I've copied Xalan from my fop dir to my ant dir, and I get now up to 100 errors (the build limit). Here follows pieces of return. Pascal compile-src: [echo] Compiling the sources [javac] Compiling 293 source files to D:\cvs\xml-fop\build\classes [javac] D:\cvs\xml-fop\src\java\org\apache\fop\fo\FOText.java:134: Undefined variable or class name: WhiteSpaceCollapse [javac] if (textInfo.whiteSpaceCollapse == WhiteSpaceCollapse.FALSE [javac]^ snip/ Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error while building FOP dev1
Jeremias Maerki wrote: Chris, have you tried under JDK 1.3? Because Pascal tries to compile under 1.3. Unfortunately, I'm at work on my notebook where I don't have a current FOP HEAD to try. I can check this out this evening. I'm running 1.4 at the moment. Ive just tried 1.3 and it fails! Not with a TransformerFactoryImpl class not found exception, but with the later errors that pascal reported. snip/ Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error while building FOP dev1
Jeremias Maerki wrote: Looks like we don't have JDK 1.3 compatibility at the moment. I think I have seen this myself under JDk 1.3 lately. Yes, I agree. snip/ Note to Devs: We should see to it that at least the Transcoders compile again under JDK 1.3 as Batik still depends on it. Unless there is a vote on dropping JDK 1.3 support for the rest I regard the current state as a bug. I may have time this week to have a look at it. We should be supporting 1.3, and I agree that it is a bug if FOP no longer compiles on 1.3. snip/ Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Error while building FOP dev1
I've just tried the latest SDK That works fine with J2 SDK 1.4.2_05 Thx to Jeremias Chris Pascal -Message d'origine- De : Chris Bowditch [mailto:[EMAIL PROTECTED] Envoyé : mardi 7 septembre 2004 15:25 À : [EMAIL PROTECTED] Objet : Re: Error while building FOP dev1 Jeremias Maerki wrote: Looks like we don't have JDK 1.3 compatibility at the moment. I think I have seen this myself under JDk 1.3 lately. Yes, I agree. snip/ Note to Devs: We should see to it that at least the Transcoders compile again under JDK 1.3 as Batik still depends on it. Unless there is a vote on dropping JDK 1.3 support for the rest I regard the current state as a bug. I may have time this week to have a look at it. We should be supporting 1.3, and I agree that it is a bug if FOP no longer compiles on 1.3. snip/ Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
!newbie generating pdf from xml-source as stream
Hello, i am trying to generate pdf on fly from dynamic xml-source adapting the official fopservlet.java example to display it on the IE6 Browser. I am also beginning with java. Here goes my code, where sXSL is the Url to my stylesheet: snip InputSource xslSource = new InputSource(new URL(sXSL).openStream()); InputSource xmlSource = new InputSource (new StringReader(sReturnString)); XSLTInputHandler input = new XSLTInputHandler(xslSource, xmlSource); //StreamSource xmlSource = new StreamSource(new StringReader(sReturnString)); renderXML(input, c_response); /snip where renderXML is slightly different from the original snip public void renderXML(XSLTInputHandler input, HttpServletResponse response) throws ServletException { try { log(renderXML); ByteArrayOutputStream out = new ByteArrayOutputStream(); response.setContentType(application/pdf); response.setHeader( Content-disposition,inline; filename=test.pdf ); Driver driver = new Driver(); driver.setLogger(logPDF); driver.setRenderer(Driver.RENDER_PDF); driver.setOutputStream(out); driver.render(input.getParser(), input.getInputSource()); byte[] content = out.toByteArray(); response.setContentLength(content.length); response.getOutputStream().write(content); response.getOutputStream().flush(); } catch (Exception ex) { throw new ServletException(ex); } } /snip What is wrong ? if have also tried do it with the transformer object: snip public void generatePdf(String xml, String xslPfad, OutputStream pdfOutput) throws Exception { try{ c_response.setContentType(application/pdf); c_response.setHeader( Content-disposition,inline; filename=test.pdf ); Source streamSource = new StreamSource(new URL(xslPfad).openStream()); Source saxSource = new SAXSource(new InputSource(new StringReader(xml))); Driver driver = new Driver(); Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_WARN); MessageHandler.setScreenLogger(logger); driver.setLogger(logger); //driver.setLogger(getLogger()); driver.setRenderer(Driver.RENDER_PDF); driver.setOutputStream(pdfOutput); TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer = tf.newTransformer(streamSource); Result result = new SAXResult(driver.getContentHandler()); transformer.transform(saxSource, result); } catch (Exception e) { } finally{ //pdfOutput.close(); } } /snip calling this with: snip OutputStream out = new ByteArrayOutputStream(); try { generatePdf(sReturnString, sXSL, out); } catch (Exception e) { } /snip Thanks for your help, Hans Braumüller - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How can i adjust the table width and height according to table co ntent?
Hi all, How can i adjust the table width and height according to table content? Suppose I am not specifying the table width and height in table element, the table will be displayed on the entire page width. (It occupying entire page width.)How can I adjust table width and height? For solving this problem, any attribute is available with fo:table-column.Because fop does not support fo:table-caption and table-layout. I would like to know whether it will affect auto redraw (automatically adjust with table contents) of the table. Another problem is whenever I am specifying the height attribute with table,the table will adjust with the height.But the column height is not adjust with table height.Please tell me how can I solve this problem... Thanks in advance george ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how can I create template for manipulating embedded and external style sheet present in the html page? Is it possible?
On Sep 6, 2004, at 7:06 AM, Eldho George wrote: Hi, I would like to know how can I create template for manipulating embedded and external style sheet present in the html page? Is it possible? Please help meplease tell me is it possible with xslt+xsl-fo? I already created template for processing inline style attribute. Is it possible for you to create an attribute-set and use that to modify your pages/tables, etc. document-wide? Here's a link which might help[1]. BTW, this isn't a tool for 'converting' a CSS file to XSL/XSLT. You would have to set up an attribute-set, and then implement it for the document using the use-attribute-set attribute. Hope this helps! Web Maestro Clay [1] http://www.xml.com/lpt/a/2003/06/11/short-xslt.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Probably simple build issue
I have installed FOP 0.20.5 and ant 1.6.1 running JDK 1.4.2_03. I was just trying to run build -projecthelp and I received the error below. ant.jar is in my Classpath. I know why I am receiving the error...it is because org/apache/tools/ant/launch/AntMain does not exist in that jar file. I looked in build.bat that came with the FOP installation and it is looking for ant 1.5.1, so for grins I downloaded that version and org/apache/tools/ant/launch/AntMain does not exist in that jar file either. I did find it in my current ant installation in ant-launcher.jar. Any ideas why it is looking for this class and how do I get around this? Thanks. C:\Program Files\Altova\FOP\examples\embeddingbuild -projecthelp Fop Build System ANT HOME c:\ant Building with classpath c:\ant\lib\ant.jar;../../lib\xml-apis.jar;../../lib\xercesImpl-2.2.1.jar;../../lib\xalan-2.4.1.jar Starting Ant... Ant path... c:\ant Exception in thread main java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/AntMain at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:537) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) C:\Program Files\Altova\FOP\examples\embedding - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]