retrive a parameter in the xsl

2010-07-12 Thread Red Light
Hi,

i want to obtain the pagination under this form:  Page 1 of 12
there is an interesting link in the Apache Fop FAQ 
http://xmlgraphics.apache.org/fop/fo.html#fo-total-pages

but i'm having trouble to get the wanted result , in my pdf rendering class
i do the tranformation 2 times , the first time i check if there is any problem 
with the xsl or the xml data then i got and generate the pdf wich is the final 
rendering so in the first one i retrieve the number of pages and i use the 
result in the second rendering.


//setup XSLT
TransformerFactory tranFactory = TransformerFactory.newInstance(); 
Transformer aTransformer = tranFactory.newTransformer(xsltfile); 
aTransformer.setParameter(page-count,nbrPages);   
 
 aTransformer.transform(src, res); 
System.out.println(getParameter : +aTransformer.getParameter(page-count));


it works the print print the number of pages now in my xslt

i declare a variable like:
xsl:variable name=page-count/xsl:variable

and i'm trying to print it:

xsl:value-of select=$page-count /   

but no result(i'm feeling like missing something btu what ;d?) ?


and thanks a lot





  


-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: Problem with keep-with-next=always and keep-with-previous=always fop 0.20.5

2010-07-12 Thread Chris Bowditch

asitha w wrote:
 

Hi every one, I’m facing a problem with keep-with-next=always and 
keep-with-previous=always properties


Hi,



The fop version that I’m dealing with is 0.20.5


Can't you upgrade to 0.95 where this bug probably doesn't exist? 0.20.5 
was released in 2003. This is the reason no one replies to your post. No 
one remembers how this is very old version works anymore.


Thanks,

Chris



 


The problem:

Whenever table contains table header* and if a row contains data that 
does not fit to a single page, and if this row is added to a 
keep-with-next list or a keep-with-previous, the table get corrupted. 
Eg: the whole table get printed in a single page overlapping the footer.


 


EG

 _

|   TABLE HEADER  |

|_|

|row 1 - keep-with-next=always  |

|_|

|row 2 - keep-with-next=always  |

|_|

|row 3 - keep-with-next=always  |

|_|

|row 4 - keep-with-next=always  |

|_|

 

 

Seems that when this is the case. all rows are added to a single array 
list and finally dropped to the page, and when one row contains a row 
which is larger than the page (eg row 2). It creates a one single page 
overflowing the page footer to the very end of the page.


 

And if we disconnect the keep with array. Eg remove keep-with-next from 
the  row 1, all works as expected!


 

It seems that, if the first row of the table is joined with a keep-with 
list and if this list contains larger than page row this error will 
come. Seems to be that one row must be laid solidly on the page in order 
to keep-with larger than page rows to be work.  

 


Did anyone else faced the same when using fop 0.20.5 ?

Can someone point me where in fop code should I look for calculating and 
splitting according to the remaining page height vs. largest cell height?


(org.apache.fop.fo.flow. TableRow. Layout ?)

 

What I want to do is, check if the remaining height is not enough move 
to the next page. Print as much as possible then *continue to the next. 
Whats happening is it just move to the next page and dump all the 
content in the next page.


 


Thanks in advance

Asitha.




-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: Problem with keep-with-next=always and keep-with-previous=always fop 0.20.5

2010-07-12 Thread asitha w
Hi,



I’m (we are) stuck with this ancient version of FOP.

@Chris updating the fop version is not an option rite now.



I did spend a considerable time with the fop code. I do have sort of 80%
working solution to my problem. I will post it here just in case someone
form the past like me find it helpful.



Class: org.apache.fop.fo.flow.TableRow

Method: public int layout(Area area);



Add another check where you update the largest cell height.

…

} else if (h  largestCellHeight) {

largestCellHeight = h;

fix_start

if(largestCellHeightspaceLeft)

{

this.resetMarker();

this.removeID(area.getIDReferences());

return Status.AREA_FULL_NONE;

}

fix_end

}

…



This will simply skip the current page and move on to the next page.  But I
still have some black box area with this solution. eg how does the original
keep with properties get  dropped.

Not happy but gotta live with this until we decide to update the FOP.



Side effects of the above workaround.

It will add a blank page, before the keepwith list, anyone know how to
remove already added page from the output.



Anyways

Thanks everyone for reading this.


On Mon, Jul 12, 2010 at 4:27 PM, Chris Bowditch
bowditch_ch...@hotmail.comwrote:

 asitha w wrote:


 Hi every one, I’m facing a problem with keep-with-next=always and
 keep-with-previous=always properties


 Hi,



 The fop version that I’m dealing with is 0.20.5


 Can't you upgrade to 0.95 where this bug probably doesn't exist? 0.20.5 was
 released in 2003. This is the reason no one replies to your post. No one
 remembers how this is very old version works anymore.

 Thanks,

 Chris




 The problem:

 Whenever table contains table header* and if a row contains data that does
 not fit to a single page, and if this row is added to a keep-with-next list
 or a keep-with-previous, the table get corrupted. Eg: the whole table get
 printed in a single page overlapping the footer.


 EG

  _

 |   TABLE HEADER  |

 |_|

 |row 1 - keep-with-next=always  |

 |_|

 |row 2 - keep-with-next=always  |

 |_|

 |row 3 - keep-with-next=always  |

 |_|

 |row 4 - keep-with-next=always  |

 |_|



 Seems that when this is the case. all rows are added to a single array
 list and finally dropped to the page, and when one row contains a row which
 is larger than the page (eg row 2). It creates a one single page overflowing
 the page footer to the very end of the page.


 And if we disconnect the keep with array. Eg remove keep-with-next from
 the  row 1, all works as expected!


 It seems that, if the first row of the table is joined with a keep-with
 list and if this list contains larger than page row this error will come.
 Seems to be that one row must be laid solidly on the page in order to
 keep-with larger than page rows to be work.

 Did anyone else faced the same when using fop 0.20.5 ?

 Can someone point me where in fop code should I look for calculating and
 splitting according to the remaining page height vs. largest cell height?

 (org.apache.fop.fo.flow. TableRow. Layout ?)


 What I want to do is, check if the remaining height is not enough move to
 the next page. Print as much as possible then *continue to the next. Whats
 happening is it just move to the next page and dump all the content in the
 next page.


 Thanks in advance

 Asitha.



 -
 To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
 For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org




RE: retrive a parameter in the xsl

2010-07-12 Thread Eric Douglas
Rather than trying to transform it twice so the second time knows the
number of pages, I found the simplest way to get the page count is to
force a page reference onto the last page.

...
/xsl:for-each
   /xsl:for-each
   fo:block
xsl:attribute name=idlast-page/xsl:attribute
xsl:attribute
name=positionabsolute/xsl:attribute
xsl:attribute name=left0/xsl:attribute
xsl:attribute name=top0/xsl:attribute
xsl:attribute name=width0/xsl:attribute
xsl:attribute name=height0/xsl:attribute
   /fo:block
  /fo:flow
...
Then where I want to put the last page number into my text, I put a page
number variable I made up into my text tag in the xml:

xsl:for-each select=TEXT
 xsl:choose
  xsl:when test=VARIABLE =
'%CURRENT_PAGE%'fo:page-number //xsl:when
  xsl:when test=VARIABLE =
'%LAST_PAGE%'fo:page-number-citation ref-id=last-page//xsl:when
  xsl:otherwisexsl:value-of
select=.//xsl:otherwise
 /xsl:choose
/xsl:for-each
 

-Original Message-
From: Red Light [mailto:skydelt...@yahoo.com] 
Sent: Monday, July 12, 2010 5:48 AM
To: fop-users@xmlgraphics.apache.org
Subject: retrive a parameter in the xsl 

Hi,

i want to obtain the pagination under this form:  Page 1 of 12 there is
an interesting link in the Apache Fop FAQ
http://xmlgraphics.apache.org/fop/fo.html#fo-total-pages

but i'm having trouble to get the wanted result , in my pdf rendering
class i do the tranformation 2 times , the first time i check if there
is any problem with the xsl or the xml data then i got and generate the
pdf wich is the final rendering so in the first one i retrieve the
number of pages and i use the result in the second rendering.


//setup XSLT
TransformerFactory tranFactory = TransformerFactory.newInstance();
Transformer aTransformer = tranFactory.newTransformer(xsltfile); 
aTransformer.setParameter(page-count,nbrPages);

 aTransformer.transform(src, res);
System.out.println(getParameter :
+aTransformer.getParameter(page-count));


it works the print print the number of pages now in my xslt

i declare a variable like:
xsl:variable name=page-count/xsl:variable

and i'm trying to print it:

xsl:value-of select=$page-count /   

but no result(i'm feeling like missing something btu what ;d?) ?


and thanks a lot





  


-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org


-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



PDF output: fragment identifier working ?

2010-07-12 Thread Mathieu Malaterre
Hi there,

  I am trying to link one PDF to another PDF. If I use the following:

$ cat foo.fo
...
 fo:basic-link external-destination=bla.pdf
show-destination=replacebla/fo:basic-link
...

Then I can open the the foo.pdf file and properly click on the 'bla'
link. However if I try to use fragment identifier like this:

 fo:basic-link external-destination=bla.pdf#id
show-destination=replacebla at index: id/fo:basic-link

Then acroread try to open a link from firefox...

Could someone please let me know what is the proper syntax for linking
to specific fragment identifier from pdf to another pdf ?

Thanks !
-- 
Mathieu
Using: fop 0.95

-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Error (Exception in thread Root Thread java.lang.StackOverflowError) while transforming XML data using .xsl file using Oracle 11g R1

2010-07-12 Thread Jayant Ghagre

Hello,

I am getting following error while transforming XML data file to PDF
using .XSL file. I have loaded FOP 0.95 in Oracle 11g R1 database. I am
calling FOP using Java Stored Procedure.

The same code executes without any errors in stand-alone mode (Windows XP
with JDK 1.5)

Exception in thread Root Thread java.lang.StackOverflowError
  at java.lang.String.valueOf(String.java)
  at java.lang.StringBuffer.append(StringBuffer.java)
  at org.apache.fop.fo.properties.PercentLength.toString
(PercentLength.java)
  at java.lang.String.valueOf(String.java)
  at java.lang.StringBuffer.append(StringBuffer.java)
  at org.apache.fop.fo.flow.table.TableColumn.toString
(TableColumn.java)
  at java.lang.String.valueOf(String.java)
  at java.util.AbstractCollection.toString(AbstractCollection.java)
  at org.apache.fop.layoutmgr.table.ColumnSetup.toString
(ColumnSetup.java:125)
  at java.lang.String.valueOf(String.java)
  at java.lang.StringBuffer.append(StringBuffer.java)
  at
org.apache.fop.layoutmgr.table.TableContentLayoutManager.getNextKnuthElements
(TableContentLayoutManager.java:132)
  at
org.apache.fop.layoutmgr.table.TableLayoutManager.getNextKnuthElements
(TableLayoutManager.java:247)
  at
org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements
(BlockStackingLayoutManager.java)
  at org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements
(BlockLayoutManager.java:116)
  at org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements
(FlowLayoutManager.java:107)
  at org.apache.fop.layoutmgr.PageBreaker.getNextKnuthElements
(PageBreaker.java:145)
  at org.apache.fop.layoutmgr.AbstractBreaker.getNextBlockList
(AbstractBreaker.java:552)
  at org.apache.fop.layoutmgr.PageBreaker.getNextBlockList
(PageBreaker.java:137)
  at org.apache.fop.layoutmgr.AbstractBreaker.doLayout
(AbstractBreaker.java:302)
  at org.apache.fop.layoutmgr.AbstractBreaker.doLayout
(AbstractBreaker.java:264)
  at org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout
(PageSequenceLayoutManager.java:106)
  at org.apache.fop.area.AreaTreeHandler.endPageSequence
(AreaTreeHandler.java:234)
  at org.apache.fop.fo.pagination.PageSequence.endOfNode
(PageSequence.java:123)
  at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement
(FOTreeBuilder.java)
  at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java)
  at org.apache.xml.serializer.ToXMLSAXHandler.endElement
(ToXMLSAXHandler.java)
  at org.apache.xalan.templates.ElemLiteralResult.execute
(ElemLiteralResult.java)
  at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java)
  at org.apache.xalan.templates.ElemLiteralResult.execute
(ElemLiteralResult.java)
  at
org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes
(ElemApplyTemplates.java:395)
  at org.apache.xalan.templates.ElemApplyTemplates.execute
(ElemApplyTemplates.java:177)
  at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java)
  at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode
(TransformerImpl.java:2202)
  at org.apache.xalan.transformer.TransformerImpl.transformNode
(TransformerImpl.java:1276)
  at org.apache.xalan.transformer.TransformerImpl.transform
(TransformerImpl.java:673)
  at org.apache.xalan.transformer.TransformerImpl.transform
(TransformerImpl.java:1192)
  at org.apache.xalan.transformer.TransformerImpl.transform
(TransformerImpl.java:1170)


Thanks,
Jayant



-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: Error (Exception in thread Root Thread java.lang.StackOverflowError) while transforming XML data using .xsl file using Oracle 11g R1

2010-07-12 Thread Chris Bowditch

Jayant Ghagre wrote:

Hello,

I am getting following error while transforming XML data file to PDF
using .XSL file. I have loaded FOP 0.95 in Oracle 11g R1 database. I am
calling FOP using Java Stored Procedure.

The same code executes without any errors in stand-alone mode (Windows XP
with JDK 1.5)

Exception in thread Root Thread java.lang.StackOverflowError
  at java.lang.String.valueOf(String.java)


When running within Oracle Instance you may just need more than 64Kb 
stack space. You could try specifying -Xss2M to JVM startup parameters 
to see if it resolves the issue


Thanks,

Chris

-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: PDF output: fragment identifier working ?

2010-07-12 Thread Jeremias Maerki
Hi Mathieu

Hmm, that doesn't seem to be well documented.

external-destination=url(my.pdf#dest=chapter1)
...gets you to the named destination chapter1 in my.pdf.

external-destination=url(my.pdf#page=7)
...gets you to page 7 in my.pdf.

Details in org.apache.fop.pdf.PDFFactory.getExternalAction(String, boolean)

Info on how to create a named destination with FOP:
http://xmlgraphics.apache.org/fop/latest/extensions.html#named-destinations

On 12.07.2010 14:56:33 Mathieu Malaterre wrote:
 Hi there,
 
   I am trying to link one PDF to another PDF. If I use the following:
 
 $ cat foo.fo
 ...
  fo:basic-link external-destination=bla.pdf
 show-destination=replacebla/fo:basic-link
 ...
 
 Then I can open the the foo.pdf file and properly click on the 'bla'
 link. However if I try to use fragment identifier like this:
 
  fo:basic-link external-destination=bla.pdf#id
 show-destination=replacebla at index: id/fo:basic-link
 
 Then acroread try to open a link from firefox...
 
 Could someone please let me know what is the proper syntax for linking
 to specific fragment identifier from pdf to another pdf ?
 
 Thanks !
 -- 
 Mathieu
 Using: fop 0.95
 


Jeremias Maerki


-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: PDF output: fragment identifier working ?

2010-07-12 Thread Mathieu Malaterre
Jeremias,

  Thanks a bunch !
  So just for reference. If you are doing some docbook - fo
generation. The output fo (from docbook 1.75) is slightly incorrect.
You actually need to add:

fox:destination
xmlns:fox=http://xmlgraphics.apache.org/fop/extensions;
internal-destination=chapter1/

  right after a fo:block/ (anywhere in the document seems to be fine).

  And then on the other side, you need to patch the link

fo:basic-link show-destination=replace
external-destination=my.pdf#chapter1Managing

into

fo:basic-link show-destination=replace
external-destination=url(my.pdf#dest=chapter1)Managing

  All is left to do...is try to automated that directly within docbook...

Thanks !
Ref:
http://www.mail-archive.com/fop-...@xmlgraphics.apache.org/msg06568.html

On Mon, Jul 12, 2010 at 4:42 PM, Jeremias Maerki d...@jeremias-maerki.ch 
wrote:
 Hi Mathieu

 Hmm, that doesn't seem to be well documented.

 external-destination=url(my.pdf#dest=chapter1)
 ...gets you to the named destination chapter1 in my.pdf.

 external-destination=url(my.pdf#page=7)
 ...gets you to page 7 in my.pdf.

 Details in org.apache.fop.pdf.PDFFactory.getExternalAction(String, boolean)

 Info on how to create a named destination with FOP:
 http://xmlgraphics.apache.org/fop/latest/extensions.html#named-destinations

 On 12.07.2010 14:56:33 Mathieu Malaterre wrote:
 Hi there,

   I am trying to link one PDF to another PDF. If I use the following:

 $ cat foo.fo
 ...
      fo:basic-link external-destination=bla.pdf
 show-destination=replacebla/fo:basic-link
 ...

 Then I can open the the foo.pdf file and properly click on the 'bla'
 link. However if I try to use fragment identifier like this:

      fo:basic-link external-destination=bla.pdf#id
 show-destination=replacebla at index: id/fo:basic-link

 Then acroread try to open a link from firefox...

 Could someone please let me know what is the proper syntax for linking
 to specific fragment identifier from pdf to another pdf ?

 Thanks !
 --
 Mathieu
 Using: fop 0.95



 Jeremias Maerki


 -
 To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
 For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org





-- 
Mathieu

-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Font.Cache folder

2010-07-12 Thread Jayant Ghagre

Hello,

How can I specify font cache folder using configuration file?

baseDriveName:\FolderName/base

The above configuration works for stand-alone version but fails in Oracle
11g.


Error:
\.fop\fop-fonts.cache is not an acceptable relative path when user.dir is
E:\APP\ORACLE\PRODUCT\11.1.0\DB_1\


Thanks for your help.

Regards,
Jayant



-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



How to initialize Log4j logging in Oracle 11g

2010-07-12 Thread Jayant Ghagre

Hello,

I am getting following warning message when I execute FOP 0.95 in Oracle
11g using Java Stored procedure. How can I address this issue?

log4j:WARN No appenders could be found for logger
(org.apache.fop.util.ContentHandlerFactoryRegistry).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
more info.


Thanks,
Jayant



-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org