xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig Christophersen" <crai...@synesis7.com>
Subject RE: xml processing instructions in textual content
Date Thu, 23 Feb 2012 00:11:26 GMT
Exactly.  Except I have no control over the editing/authoring tool used or
its configuration.  My process must handle  it if it meets xml specs.


From: Luis Bernardo [mailto:lmpmbernardo@gmail.com] 
Sent: Wednesday, February 22, 2012 4:41 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: xml processing instructions in textual content


OK, I understand what you mean now. Your editor/authoring tool adds those
<?Pub Caret?> and you don't want that to break your PDF generation.

I don't know what the expected behavior should be. I will have to

On 2/22/12 1:04 AM, Craig Christophersen wrote: 

>From xml and xsl.

Xml simple example:

<?xml version="1.0" encoding="UTF-8"?>


  <para> text con<?Pub Caret?>tent here </para>



Xsl from parent template:

<fo:block font-size="10pt" text-align="left" padding-before="1mm"
margin-left="1mm" margin-right="1mm" padding-after="1mm" font-weight="bold"
orphans="2" widows="2">
            <xsl:call-template name="para">



Simple xsl para template(para template I do a lot of testing for child
elements of para and do formatting accordingly for each different element
that can appear in the para besides text)

But simply if just text in para element as below :


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform" xmlns:fo=
<http://www.w3.org/1999/XSL/Format> "http://www.w3.org/1999/XSL/Format">
<xsl:template name="para"   xmlns:fo= <http://www.w3.org/1999/XSL/Format>

    <xsl:value-of select="text()"/>




From: Luis Bernardo [mailto:lmpmbernardo@gmail.com] 
Sent: Tuesday, February 21, 2012 5:07 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: xml processing instructions in textual content


So, are you generating PDF from XML and XSL, or from FO?

For instance, as an example, if I want PDF to show XML content, and I start
from XML and XSL then I put this in the XML file:

<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo= <http://www.w3.org/1999/XSL/Format>
    <fo:simple-page-master margin="2cm"
      page-width="21.0cm" page-height="29.7cm" master-name="A4-portrait">
      <fo:region-body />
  <fo:page-sequence master-reference="A4-portrait">
    <fo:flow flow-name="xsl-region-body">
      <fo:block>Hello World!</fo:block>

and something like this in the XSL file:

    <xsl:apply-templates select="example" />
  <xsl:template match="example">
        <fo:block font-size="12pt" linefeed-treatment="preserve"
white-space-treatment="preserve" white-space-collapse="false"
          <xsl:value-of select="." />

Then fop -xml example.xml -xsl example.xsl -pdf example.pdf generates a PDF
with the example you see above inside the <![CDATA[]]>.

If you are working with FO, then you can use the above example and fop -xml
example.xml -xsl example.xsl -foout example.fo to see how it should look

<fo:block font-family="monospace" white-space-collapse="false"
white-space-treatment="preserve" linefeed-treatment="preserve"

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;fo:root xmlns:fo= <http://www.w3.org/1999/XSL/Format>
    &lt;fo:simple-page-master margin="2cm"
      page-width="21.0cm" page-height="29.7cm" master-name="A4-portrait"&gt;
      &lt;fo:region-body /&gt;
  &lt;fo:page-sequence master-reference="A4-portrait"&gt;
    &lt;fo:flow flow-name="xsl-region-body"&gt;
      &lt;fo:block&gt;Hello World!&lt;/fo:block&gt;


On 2/21/12 11:35 PM, Craig Christophersen wrote: 

I am encountering xml processing instructions in textual content.  Example:
" <para> text con<?Pub Caret?>tent here </para>"

The resulting pdf from using FOP is " text con" followed by content from the
next element.  The remainder of the text content following the processing
instruction "tent here" is left out.

Is this a bug?  Is there something I can configure in FOP config.xml to
handle this?   Processing instructions are allowed in textual content of xml

Using FOP 1.0, Windows 7, JDK 1.6.0_26



Craig Christophersen

Software Developer






View raw message