From: Vincent M. <vi...@ma...> - 2017-05-18 07:11:05
|
Hi Ronald, > On 17 May 2017, at 21:24, Ronald Brill <rb...@rb...> wrote: > > Hi Vincent, > > thanks for considering CSSParser as alternative solution. > CSSParser is a smaller/more focused solution; only parsing the css into some tree sturcture is the current focus of the project. There is no support to parse (X)Html and also no > help for mixing the two trees into one. > As far as i know there are two main use cases for CSSParser at the moment: > * parsing a css for error detection or optimization and optional writing back the optimized version (The cleanup/optimization is not part of CSSParser) > * parsing a css to support html processing > > The second case is what is done by HtmlUnit (i'm also involved with this project). HtmlUnit uses NekoHtml to parse (X)Html and CSSParser for css. Then HtmlUnit uses both > informations to simulate real browser behavior. > If you like i can think a bit if your use case is someting that can be done with HtmlUnit - give me a sign and i will have a look ;-) > > Outside of this i'm a bit curious about your case. Usually the css is separated from the Html by idea. Why you like to merge this? Thanks for your reply. Yes I agree that the use case may look weird from the outside :) So let me explain. This is for the XWiki PDF export. The big steps are (better explained here: http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Configuration#HCustomizingthePDFexportLook26Feel): * Render a wiki page into XHTML * Apply CSS4J to merge the pdf.css and user-customized CSS for PDF export into the generated XHTML * Apply a xhtml2fo.xsl XSL stylesheet to generate XSL-FO * Use Apache FOP to convert from XSL-FO to PDF The problem is probably because XSL-FO doesn’t support defining the styles into CSS so in any case there’s a need to convert the CSS into something usable by XSL-FO processors such as Apache FOP. I did a quick search and found http://stackoverflow.com/questions/17495152/using-external-css-in-xsl-fo but that is far from simple and requires to convert CSS into some XSL. Thanks -Vincent > RBRi > > On Tue, 16 May 2017 18:18:56 +0200 Vincent Massol wrote: >> >> Hi guys, >> >> On the XWiki project (http://xwiki.org) we're currently using CSS4J but it's painful (several bugs, no issue tracker, no mailing list) so we're considering migrating to another > library and we're looking at CSSParser. >> >> We use CSS4J to do the following: apply some CSS content to XHTML. >> >> For example: >> >> CSS: >> "span { color:red; }" >> >> XHTML: >> ... >> <div id="xwikicontent"> >> <p><span style="background: white;">Hello</span></p> >> </div> >> >> >> Result: >> ... >> <div id="xwikicontent"> >> <p><span style="background: white; color: red;">Hello</span></p> >> </div> >> >> >> Is that possible to do with CSSParser? >> >> FTR this is our code where we use CSS4J: >> * > https://github.com/xwiki/xwiki-platform/blob/30d27eb8ec23f7c5a28ca505a75f1c73f8fe0073/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xw > iki/pdf/impl/PdfExportImpl.java#L460-L460 >> * > https://github.com/xwiki/xwiki-platform/blob/30d27eb8ec23f7c5a28ca505a75f1c73f8fe0073/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xw > iki/pdf/impl/PdfExportImpl.java#L506 >> >> Thanks >> -Vincent >> ------------------------------------------------------------------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> _______________________________________________ >> cssparser-developers mailing list >> css...@li... >> https://lists.sourceforge.net/lists/listinfo/cssparser-developers >> > |