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:17:10 GMT
Sorry, meant to add.  I think the expected behavior in textual content would
be to be able to  ignore the processing instruction.  It seems to be ignored
if it occurs in places other than textual content..

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

<example>

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

<para>more  text content here </para>

</example>

The second instance of <?Pub Caret?> above is ignored.

 

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
investigate.

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

>From xml and xsl.

Xml simple example:

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

<example>

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

</example>

 

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">

</fo:block>

 

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>
"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>
"http://www.w3.org/1999/XSL/Format">

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

</xsl:template>

 

 

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:

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

and something like this in the XSL file:

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

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
like:

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

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;fo:root xmlns:fo= <http://www.w3.org/1999/XSL/Format>
"http://www.w3.org/1999/XSL/Format"&gt;
  &lt;fo:layout-master-set&gt;
    &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:simple-page-master&gt;
  &lt;/fo:layout-master-set&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;
    &lt;/fo:flow&gt;
  &lt;/fo:page-sequence&gt;
&lt;/fo:root&gt;

 </fo:block>


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
elements.

Using FOP 1.0, Windows 7, JDK 1.6.0_26

 

 

Craig Christophersen

Software Developer

Synesis7

craigch@synesis7.com

 

 

 


Mime
View raw message