directly converting 'lt;' to html in .fo file
Hi all, Ready for this? I have an xml file which needs to be translated to a PDF using apache FOP. So far so good. Now, one element in the XML file actually contains a HTML fragment, which is stored in the XML file by replacing alle the '' and '/' with 'lt;' and 'gt;'. This replacement is automatically done by the JaxME Java databinding framework we use and occurs because the element is declared to by of type 'xsd:string' (standard string xml type). The element looks like this in the XML file: response_root_title lt;pgt;The 'gender' field is used internally to signal any reduced risks associated with the administrative issues which comply with the general policy of the company.lt;/pgt; lt;pgt;Any additional gender specific parameters should lt;stronggt;notlt;/stronggt; be disclosed to other parties accept those involved in the completion of the current administrative process.lt;/pgt; lt;pgt;Gender will lt;stronggt;notlt;/stronggt; be lt;emgt;discriminativelt;/emgt; regarding anything, but will be used to lt;emgt;differentiatelt;/emgt; everything.lt;/pgt; /response_root_title Now here's the problem. When I use FOP to generate the PDF, the 'lt;' and the like characters are all nicely restored to HTML tags. But this means that my PDF shows HTML tags. I don't want that. I want to apply an extra transformation in my .fo file so that during the FOP rendering, I can replace the HTML tags in the text fragment with their appropriate fo:XXX equivalent markup. For example: substitute strongABCD/strong with something like fo:font boldABCD/fo:font. In short, I need to: 1. extract the data from the xml element; 2. convert the XML escapes to '' and ''; 3. apply styles to the html. How do I do this? What is the approptiate XSL method to, e.g., capture output from a character-replace routine into a variable for later use? Hope You can help! Thanx, Bart. -- View this message in context: http://www.nabble.com/directly-converting-%27-lt-%27-to-html-in-.fo-file-t1784919.html#a4861356 Sent from the FOP - Users forum at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: directly converting 'lt;' to html in .fo file
Hi Bart, Perhaps you can escape the from lt; as well? So would become amp;lt; . I assume FOP would unescape amp; to , so you would subsequently get lt; passed from FOP. Note that I have no idea if FOP does recursive unescaping, but I assume it doesn't. If it does though, this trick won't help obviously. Regards, Jeroen Op 14-6-2006 10:54, schreef Bart van Riel: Hi all, Ready for this? I have an xml file which needs to be translated to a PDF using apache FOP. So far so good. Now, one element in the XML file actually contains a HTML fragment, which is stored in the XML file by replacing alle the '' and '/' with 'lt;' and 'gt;'. This replacement is automatically done by the JaxME Java databinding framework we use and occurs because the element is declared to by of type 'xsd:string' (standard string xml type). The element looks like this in the XML file: response_root_title lt;pgt;The 'gender' field is used internally to signal any reduced risks associated with the administrative issues which comply with the general policy of the company.lt;/pgt; lt;pgt;Any additional gender specific parameters should lt;stronggt;notlt;/stronggt; be disclosed to other parties accept those involved in the completion of the current administrative process.lt;/pgt; lt;pgt;Gender will lt;stronggt;notlt;/stronggt; be lt;emgt;discriminativelt;/emgt; regarding anything, but will be used to lt;emgt;differentiatelt;/emgt; everything.lt;/pgt; /response_root_title Now here's the problem. When I use FOP to generate the PDF, the 'lt;' and the like characters are all nicely restored to HTML tags. But this means that my PDF shows HTML tags. I don't want that. I want to apply an extra transformation in my .fo file so that during the FOP rendering, I can replace the HTML tags in the text fragment with their appropriate fo:XXX equivalent markup. For example: substitute strongABCD/strong with something like fo:font boldABCD/fo:font. In short, I need to: 1. extract the data from the xml element; 2. convert the XML escapes to '' and ''; 3. apply styles to the html. How do I do this? What is the approptiate XSL method to, e.g., capture output from a character-replace routine into a variable for later use? Hope You can help! Thanx, Bart. -- View this message in context: http://www.nabble.com/directly-converting-%27-lt-%27-to-html-in-.fo-file-t1784919.html#a4861356 Sent from the FOP - Users forum at Nabble.com. - 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: directly converting 'lt;' to html in .fo file
On Wednesday 14 June 2006 11:54 am, Bart van Riel wrote: convert the XML escapes to '' and ''; This can be usefull: xsl:value-of disable-output-escaping=yes select=HTMLBody/ -- Regards, Lev T. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RE : directly converting 'lt;' to html in .fo file
Hi, Thanx for your reply. OK, so I need to: 1. Extract the element data from the html-holding element; 2. Convert the character escapes (should be do-able); 3. Replace the original data with the coverterd. Any thoughts on the XSL commands to do this? Thanx!! Bart. -- View this message in context: http://www.nabble.com/directly-converting-%27-lt-%27-to-html-in-.fo-file-t1784919.html#a4863287 Sent from the FOP - Users forum at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE : Re: RE : directly converting 'lt;' to html in .fo file
Bart van Riel wrote: OK, so I need to: 1. Extract the element data from the html-holding element; 2. Convert the character escapes (should be do-able); xsl:transform xmlns:xsl=http://www.w3.org/1999/XSL/Transform; version=1.0 xsl:template match=/ xsl:value-of disable-output-escaping=yes select=path/to/html-holding/ /xsl:template /xsl:transform 2a. Convert that HTML to well-formed XML. For that, you can use a tool like HTMLTidy. See the W3C web site, or Google. 3. Replace the original data with the coverterd. Use a modified identity transformation to include the well-formed document: xsl:transform xmlns:xsl=http://www.w3.org/1999/XSL/Transform; version=1.0 xsl:template match=@*|node() xsl:copy xsl:apply-templates select=@*|node()/ /xsl:copy /xsl:template xsl:template match=html-holding xsl:copy-of select=document('converted.xml')/ /xsl:template /xsl:transform Any thoughts on the XSL commands to do this? Such XSLT questions (as well as XPath questions BTW) would be better asked on XSL List. Regards, --drkm __ Do You Yahoo!? En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités http://mail.yahoo.fr Yahoo! Mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
variable containing the page number
Hi I want to put the value of fo:page-number into a variable because i have different static-content depending on what page number it is. I want to use this variable to check what page number it is. Do anyone know how to do this? regards Eivind Andreassen. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: variable containing the page number
Eivind Andreassen wrote: Hi I want to put the value of fo:page-number into a variable because i have different static-content depending on what page number it is. I want to use this variable to check what page number it is. Do anyone know how to do this? Variables exist in the XSLT process, page-numbers exist only in XSL-FO-PDF generation. These are separate processes between which there is no state sharing. So what you asked for is not possible. Fortunately XSL-FO provides another means to achieve different static-content on different pages. Here is a snipper from the franklin_alt.fo file which is an example shipped with FOP: !-- layout for the first page -- fo:simple-page-master master-name=right page-height=21.7cm page-width=16cm margin-top=1cm margin-bottom=1cm margin-left=3.5cm margin-right=1.5cm fo:region-body margin-top=2cm margin-bottom=2cm/ fo:region-before extent=2cm/ fo:region-after extent=2cm/ /fo:simple-page-master fo:simple-page-master master-name=left page-height=21.7cm page-width=16cm margin-top=1cm margin-bottom=1cm margin-left=1.5cm margin-right=3.5cm fo:region-body margin-top=2cm margin-bottom=2cm/ fo:region-before extent=2cm/ fo:region-after extent=2cm/ /fo:simple-page-master fo:page-sequence-master master-name=alternating fo:repeatable-page-master-alternatives maximum-repeats=no-limit fo:conditional-page-master-reference master-reference=right odd-or-even=odd / fo:conditional-page-master-reference master-reference=left odd-or-even=even / /fo:repeatable-page-master-alternatives /fo:page-sequence-master Hopefully it gives you the idea. Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: variable containing the page number
Hi, this thread has arised an interesting point for my project ... [...] So what you asked for is not possible. Fortunately XSL-FO provides another means to achieve different static-content on different pages. do you have any idea to realize this a little more complex? what i need is: the maximun repeats in dependency on the total number of pages. i'm creating booklets with 4,8,12,16 pages and every two last pages has to be single pages. something like: fo:repeatable-page-master-alternatives maximum-repeats=pages - 2 [...] /... fo:single-page-master-reference master-reference=before-last/ fo:single-page-master-reference master-reference=last/ i know how to set the last page in a page repeat loop, but the pages before last? thanks! gregor - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: variable containing the page number
Gregor Stefan wrote: snip/ i'm creating booklets with 4,8,12,16 pages and every two last pages has to be single pages. So you want a different static-content on the last front side? something like: fo:repeatable-page-master-alternatives maximum-repeats=pages - 2 [...] /... fo:single-page-master-reference master-reference=before-last/ fo:single-page-master-reference master-reference=last/ I don't think this is possible unless you know the exact page number :( What needs to change in the static content for the last front side? If its just different text then you can achieve this using markers. snip/ Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]