[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: RE: [docbook-apps] Question on CDATA in XML
No one ? I have tried many different ways, but I am stuck... Thanks ! Fabien -----Message d'origine----- De : Fabien Tillier [mailto:f.tillier@cerep.fr] Envoyé : jeudi 24 juin 2010 10:13 À : docbook-apps@lists.oasis-open.org Objet : RE: [docbook-apps] Question on CDATA in XML Humm. If I try <bibliomixed> <rtf><![CDATA[ <span style="color: #000000; font-size: 10pt; font-family: Times New Roman"> <i>Mol. Pharmacol., </i> </span> <span style="color: #000000; font-size: 10pt; font-family: Times New Roman"> <u><i>39</i></u> </span> <span style="color: #000000; font-size: 10pt; font-family: Times New Roman"> <i>: 9-12.</i> </span> <span style="color: #000000; font-size: 8pt; font-family: MS Sans Serif"> </span> ]]></rtf> </bibliomixed> Which is not the way it should be used, I get the expected output (keeps <, not ">") [thus, you are right when stating these are special] However, it may be inefficient to use a bibliomixed tag everywhere I have to decode the HTML output (on some tables for example). I would assume that there is something special occurring within the treatment of bibliomixed or biblioentry, but I am a bit lost in the stylesheets and not knowledgeable enough to catch it. Thus, I could create a special template for handling this specifically (like with the bilbio* tags) but without the special treatments applied to a bibliographic entry. Any help/directions ? Regards, Fabien -----Message d'origine----- De : Fabien Tillier [mailto:f.tillier@cerep.fr] Envoyé : jeudi 24 juin 2010 09:03 À : Richard Hamilton; docbook-apps@lists.oasis-open.org Objet : RE: [docbook-apps] Question on CDATA in XML Hi Richard. First, thanks for answering to me. The output is the one from Kernow. Thus, you get the HTML "text" that would be (or not) interpret by the browser to display. I am trying to use the HTML because the original data is from an RTF encoded text I get from a database. I made an RTF to HTML conversion to be able to keep at least some of the formatting, so I need to keep it until I can pass it to an HTML able output (like a browser). Thus, though I would really love doing the formatting with CSS, I am bound to use the HTML as it is. Regarding Bob's book, I have it on the left of my desk, I will look at the part you are kindly pointing me to and see if it can help me. Best regards, Fabien -----Message d'origine----- De : Richard Hamilton [mailto:rlhamilton@frii.com] Envoyé : mercredi 23 juin 2010 20:39 À : docbook-apps@lists.oasis-open.org Objet : Re: [docbook-apps] Question on CDATA in XML Fabien, I'm a bit confused here. Is the output you show below what you see if you open the output file in a text editor, or what you see if you open the output in a browser? I'm guessing it's the first, and that what you are trying to do is pass html markup through unchanged to the output so that the browser will interpret it as html markup and render it. If not, you can ignore what follows:-). I'm not 100% sure why your XSL customization works in some places and not in others; maybe one of the gurus can tell. My best guess is that it is related to the unique way that biblioentry and bibliomixed are handled by the standard stylesheets. I suspect that these two elements are possibly the only places where your XSL code will work the way you want it to. I think there are better ways to do what you seem to be trying to do. I'll suggest three: 1) For bibliographic entries, I would use the full biblioref or bibliomixed markup. It should allow you to mark up pretty much any bibliographic entry you might need, and you can easily adjust the style of the output in your XSL customization layer. 2) If you create a phrase in docbook with a role, e.g.: <phrase role="somerole">some text</phrase> The stylesheets will generate a span with a class, e.g.: <span class="somerole">some text </span> You can then associate that class with the styling you want in your css file. That has the added benefit of separating the styling from your source, in case you ever want to change it. 3) If you are looking for a general means for passing through html to the output, the closest I can find is a description of how to insert html from an external file using a processing instruction. Here is a link to that description, which is from Bob Stayton's excellent book, DocBook XSL: The Complete Guide, which BTW, is essential reading if you'll be doing a lot with the DocBook stylesheets: http://www.sagehill.net/docbookxsl/InsertExtHtml.html I don't know of a way to include html in your DocBook file and have it passed through as output markup; the file inclusion described in the link above is the closest to that I could find. Maybe someone else on the list has a suggestion. Hope that helps. Dick Hamilton ----------------------------------------- XML Press XML for Technical Communicators http://xmlpress.net On Wed, 2010-06-23 at 17:36 +0200, Fabien Tillier wrote: > Hi List. > I have some hairy troubles with html encoded parts I want to convey in > DocBook XML then convert back to HTML (and later on to PDF, but that's > another sad story). > My problem is that it works in some cases but not in others (I am using > DB5.0, Saxon 9.2. Tested with Kernow) > > For example, if I have > ------------------------------------------------------------------------ > ----------- > <?xml version="1.0" encoding="ISO-8859-1"?> > <test> > <table frame="none" role="Tab1" rowsep="0" colsep="0"> > <row> > <entry role="Tab3">Assay Name</entry> > <entry role="Tab3"><rtf><![CDATA[ > <span style="color: #000000; font-size: 10pt; font-family: Times > New Roman"> > Source > </span> > ]]></rtf> > </entry> > <entry role="Tab3"><rtf><![CDATA[ > <span style="color: #000000; font-size: 10pt; font-family: Times > New Roman"> > Ligand > </span> > ]]></rtf> > </entry> > </row> > </table> > > <biblioentry id="179"> > <indexterm> > <primary>Bibl.179</primary> > </indexterm> > <subtitle><rtf><![CDATA[ > <span style="color: #000000; font-size: 10pt; font-family: Times > New Roman"> > <b>PABREZA, L.A., DHAWAN, S. and KELLAR, K.J. (1991)</b> > </span> > <span style="color: #000000; font-size: 8pt; font-family: MS Sans > Serif"> > > </span> > <span style="color: #000000; font-size: 10pt; font-family: Times > New Roman"> > > </span> > ]]></rtf> > </subtitle> > <title><rtf><![CDATA[ > <span style="color: #000000; font-size: 10pt; font-family: Times > New Roman"> > [ > </span> > <span style="color: #000000; font-size: 6pt; font-family: Times > New Roman"> > 3 > </span> > <span style="color: #000000; font-size: 10pt; font-family: Times > New Roman"> > H]cytisine binding to nicotinic cholinergic receptors in brain. > </span> > <span style="color: #000000; font-size: 8pt; font-family: MS Sans > Serif"> > > </span> > <span style="color: #000000; font-size: 10pt; font-family: Times > New Roman"> > > </span> > ]]></rtf> > </title> > <releaseinfo><rtf><![CDATA[ > <span style="color: #000000; font-size: 10pt; font-family: Times > New Roman"> > <i>Mol. Pharmacol., </i> > </span> > <span style="color: #000000; font-size: 10pt; font-family: Times > New Roman"> > <u><i>39</i></u> > </span> > <span style="color: #000000; font-size: 10pt; font-family: Times > New Roman"> > <i>: 9-12.</i> > </span> > <span style="color: #000000; font-size: 8pt; font-family: MS Sans > Serif"> > > </span> > ]]></rtf> > </releaseinfo> > </biblioentry> > </test> > ------------------------------------------------------------------------ > ----------- > As xml and the following DB XSL > ------------------------------------------------------------------------ > ----------- > <?xml version='1.0' encoding="ISO-8859-1"?> > <!-- Template to convert DocBook XML to HTML --> > > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:d="http://docbook.org/ns/docbook" > exclude-result-prefixes="d" > > <xsl:import href="docBook/xsl/html/docbook.xsl"/> > <xsl:function name="exslt:node-set" > xmlns:exslt="http://exslt.org/common" as="node()"> > <xsl:param name="node" as="node()"/> > <xsl:sequence select="$node"/> > </xsl:function> > <xsl:output method="html"/> > <xsl:param name="html.stylesheet" select="'corpstyle.css'"/> > <xsl:param name="admon.graphics" select="1"/> > > > <xsl:template match="d:rtf"> > <xsl:value-of select="text()" > disable-output-escaping="yes"/> > </xsl:template> > <xsl:template match="d:*" mode="html.title.attribute"/> > </xsl:stylesheet> > ------------------------------------------------------------------------ > ----------- > The first part gives > > Assay Name > > <span style="color: #000000; font-size: 10pt; font-family: > Times New Roman"> > Source > </span> > > > > <span style="color: #000000; font-size: 10pt; font-family: > Times New Roman"> > Ligand > </span> > > > And the second (which is correct) > > <div class="biblioentry"><a name="179"></a><p>[179] > <span class="indexterm"> > > . </span> > <span class="subtitle"> > <span style="color: #000000; font-size: 10pt; font-family: Times > New Roman"> > <b>PABREZA, L.A., DHAWAN, S. and KELLAR, K.J. (1991)</b> > </span> > <span style="color: #000000; font-size: 8pt; font-family: MS Sans > Serif"> > > </span> > <span style="color: #000000; font-size: 10pt; font-family: Times > New Roman"> > > </span> > > . </span> > <span class="title"><i> > <span style="color: #000000; font-size: 10pt; font-family: Times > New Roman"> > [ > </span> > <span style="color: #000000; font-size: 6pt; font-family: Times > New Roman"> > 3 > </span> > <span style="color: #000000; font-size: 10pt; font-family: Times > New Roman"> > H]cytisine binding to nicotinic cholinergic receptors in brain. > </span> > <span style="color: #000000; font-size: 8pt; font-family: MS Sans > Serif"> > > </span> > <span style="color: #000000; font-size: 10pt; font-family: Times > New Roman"> > > </span> > > </i>. </span> > <span class="releaseinfo"> > <span style="color: #000000; font-size: 10pt; font-family: Times > New Roman"> > <i>Mol. Pharmacol., </i> > </span> > <span style="color: #000000; font-size: 10pt; font-family: Times > New Roman"> > <u><i>39</i></u> > </span> > <span style="color: #000000; font-size: 10pt; font-family: Times > New Roman"> > <i>: 9-12.</i> > </span> > <span style="color: #000000; font-size: 8pt; font-family: MS Sans > Serif"> > > </span> > > . </span> > </p></div> > > > So, the big question is why ? > > Thanks a lot in advance > Best regards, > Fabien > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org > --------------------------------------------------------------------- To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org --------------------------------------------------------------------- To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org --------------------------------------------------------------------- To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]