Re: multi page-sequence don't work for (XML+XSL) to PDF on the fly

2004-01-10 Thread Clóvis Wichoski


Hi,

Can't you use multiple page-sequences instead of just creating one sequence
'interrupted' by the 'ctrlPage' template?
 

but How?
this template is more difficult since it is used in with a more 
complicated XML like groupproduct/.../group..., the way that I 
sent is for brevety to discover because ctrlPage don't work, for groups 
I need print a header, followed by products, etc..., in original XSL i 
use xalan extensions to count how many lines I used PDF.

A few remarks to help you on your way:
1. I can't seem to find the reason why you are placing the whole
fo:static-content  into a separate template, since it is ... well, static
and it doesn't rely on the elements in the XML (unless something is
missing).
 

because, I reduced the code for brevety, then the static-content is for 
groups case. sorry

2. In the ctrlPage template, you are testing for a position(): you could
also use XPath to select these, like
xsl:apply-templates select=product[(position() mod 3) = 0]

Then inside the product template, use

xsl:for-each select=preceding::product[position()  3] /

to grab the two preceding product nodes.
 

but for-each select don't put Xalan in DOM process? consumes more 
memory? however I can't use position because the original XML is more 
complex. (I use xalan extensions to control this). like this xsl:if 
test=counter:read('ctLine') mod 3/xsl:if

3. Check our http://xml.apache.org/fop/resources.html page, among the books
and articles, there's a link to Dave Pawson's XSLT FAQ. Over there, you'll
find a lot of useful stuff (amongst others on grouping which I think you'll
find particularly helpful), so I'll bet you can work out a redesign which
affects only the XSL itself and leaves the other files alone.
If you really can't get any further, try posting your problem on Mulberry's
XSLT list. Warning: it's a quite high-traffic list, but the upside is that
the tips are 'highly-usable' ;)
Hope this helps!

Cheers,

Andreas

 

Thanks for tips

Clovis



multi page-sequence don't work for (XML+XSL) to PDF on the fly

2004-01-09 Thread Clóvis Wichoski
Hi FOP DevTeam,

I developed a way to generate multiple page-sequence on XSL without to 
change my XML, but the XML-XSL-PDF don't work, to make this work, first 
I need to generate the .fo file, then transform this to PDF.

if run:

fop.sh -xml sample.xml -xsl multiplePageSequence.xsl -pdf sample.pdf

I get follow output:

[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] FOP 0.20.5
[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] building formatting object tree
[INFO] setting up fonts
[ERROR] org.apache.fop.apps.FOPException: flow must be child of 
page-sequence, not fo:flow

but if I first generate the .fo file with:

xalan.sh -IN sample.xml -XSL multiplePageSequence.xsl -OUT sample.fo

then generate the .pdf file from .fo file with:

fop.sh -fo sample.fo -pdf sample.pdf

I get the follow output:

[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] FOP 0.20.5
[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] building formatting object tree
[INFO] setting up fonts
[INFO] [1]
[INFO] [2]
[INFO] [3]
[INFO] [4]
[INFO] Parsing of document complete, stopping renderer
The part of XSL that cause on the fly transformation to catch the ERROR is:

xsl:template name=ctrlPage 
   xsl:if test=(position() mod 3) = 0
   xsl:text 
disable-output-escaping=yes![CDATA[/fo:flow/fo:page-sequencefo:page-sequence 
master-reference=A4 language=pt country=br]]/xsl:text
   xsl:call-template name=header/
   xsl:text disable-output-escaping=yes![CDATA[fo:flow 
flow-name=xsl-region-body]]/xsl:text
   /xsl:if
/xsl:template

to close and open fo:flow and fo:page-sequence for

xsl:template match=data
   fo:page-sequence master-reference=A4 language=pt country=br
   xsl:call-template name=header/
   fo:flow flow-name=xsl-region-body
   xsl:apply-templates /
   /fo:flow
   /fo:page-sequence
   /xsl:template
I can't understand because on the fly don't woks and from .fo file 
generated from xml+xsl transformation work, maybe a bug of FOP, or I 
can't generate XML elements using CDATA from this form.

I post this in dev list because I think that this is a feature or a bug 
on FOP then I attached the XSL and XML files that the team can test this 
issue, and the code is better to read than my bad English ;)

Thanks for any help or tip

Clovis
?xml version=1.0 encoding=ISO-8859-1?
xsl:stylesheet version=1.0
xmlns:fo=http://www.w3.org/1999/XSL/Format;
xmlns:xsl=http://www.w3.org/1999/XSL/Transform;

xsl:output method=xml/

xsl:template match=/
fo:root xmlns:fo=http://www.w3.org/1999/XSL/Format;
fo:layout-master-set
fo:simple-page-master master-name=A4 page-width=297mm  page-height=210mm margin-top=5mm  margin-bottom=5mm margin-left=3mm margin-right=5mm
fo:region-before extent=20.8mm/
fo:region-body margin-top=21.8mm margin-bottom=0in/
fo:region-after extent=0in/
fo:region-start extent=0in margin-top=0mm  margin-bottom=0mm margin-left=0mm margin-right=0mm/
fo:region-end extent=0in margin-top=0mm  margin-bottom=0mm margin-left=0mm margin-right=0mm/
/fo:simple-page-master
   /fo:layout-master-set
   xsl:apply-templates /
/fo:root
/xsl:template

xsl:template match=info/xsl:template

xsl:template match=data
fo:page-sequence master-reference=A4 language=pt country=br
xsl:call-template name=header/
fo:flow flow-name=xsl-region-body
xsl:apply-templates /
/fo:flow
/fo:page-sequence
/xsl:template
  
xsl:template match=product
xsl:call-template name=detail /
/xsl:template

!-- Header For Pages --
xsl:template name=header
fo:static-content flow-name=xsl-region-before
fo:table table-layout=fixed
fo:table-column column-width=40mm/
fo:table-column column-width=40mm/
fo:table-column column-width=40mm/
fo:table-body
fo:table-row
fo:table-cell
fo:blockHEADER CEL 1/fo:block
/fo:table-cell
fo:table-cell
fo:blockHEADER CEL 2/fo:block
/fo:table-cell
fo:table-cell
fo:blockHEADER CEL 3/fo:block
/fo:table-cell
/fo:table-row
 /fo:table-body
/fo:table
 /fo:static-content
/xsl:template

!-- Control Page Sequence Creation --
xsl:template name=ctrlPage  
xsl:if test=(position() mod 3) = 0
xsl:text disable-output-escaping=yes![CDATA[/fo:flow/fo:page-sequencefo:page-sequence master-reference=A4 

Re: multi page-sequence don't work for (XML+XSL) to PDF on the fly

2004-01-09 Thread Clóvis Wichoski




Hi Jeremias,

The CDATA is only to maintain the XSL well-formed, since I close fo:flow
on another template, the tech is good, maybe dev team implement a SAX over
the stream from XML+XSL transformation option, this is the feature that I
mean.
Note that this is to reduce memory consuption.

Best regards

Clovis



Jeremias Maerki wrote:

  On 09.01.2004 18:29:14 Clvis Wichoski wrote:
snip/
  
  
xsl:template name="ctrlPage" 
xsl:if test="(position() mod 3) = 0"
xsl:text 
disable-output-escaping="yes"![CDATA[/fo:flow/fo:page-sequencefo:page-sequence 
master-reference="A4" language="pt" country="br"]]/xsl:text
xsl:call-template name="header"/
xsl:text disable-output-escaping="yes"![CDATA[fo:flow 
flow-name="xsl-region-body"]]/xsl:text
/xsl:if
 /xsl:template

  
  
The problem is that you put some XML code into a CDATA section.
On-the-fly processing works with SAX. And in SAX your code will be
delivered as text instead of as elements.

snip/

  
  
I can't understand because on the fly don't woks and from .fo file 
generated from xml+xsl transformation work, maybe a bug of FOP, or I 
can't generate XML elements using CDATA from this form.

  
  
The latter.

  
  
I post this in dev list because I think that this is a feature or a bug 
on FOP then I attached the XSL and XML files that the team can test this 
issue, and the code is better to read than my bad English ;)

  
  
Well, bad luck. Your issue would have been a better fit for fop-user.

Jeremias Maerki


  







Re: multi page-sequence don't work for (XML+XSL) to PDF on the fly

2004-01-09 Thread Clóvis Wichoski
Chris Bowditch wrote:

Opening and closing XML tags within different XSL templates is bad 
practice. You'll need to redesign your XSL stylesheet or run the XSL 
Transform as a separate process, serialize the resulting FO and then 
present the FO to FOP.
But with multiple pages like 500 pages the redesign must be in XML 
source, that need redesign in all XSL too (HTML, PDF, TXT and many 
others), this cause a rework that I attempted to avoid, and only needed 
because FOP throubles with memory, this is only a relief.

Thanks for all reply

Clovis



How format to dot-matrix printers (ESC/P)

2002-03-21 Thread Clóvis Wichoski

Hi FOP team,

I'm using FOP for generating PDF's, but now I need use FOP to generate 
text files (txt) for dot-matrix printers using Epson ESC/P, and I have 
following questions:

1) I need create my own Renderer?
 if yes, what I need to share this with FOP-DEV

2) Can I do this with TXTRenderer?
 if yes, How put chars like CHR(27) CHR(18) in txt?

Best regards

Clóvis Wichoski
Supridatta


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: How format to dot-matrix printers (ESC/P)

2002-03-21 Thread Clóvis Wichoski


I'm already using PDFs to print, but some dot-matrix printers are too 
slow to print graphics.

the question about chars, it is because I need print in condensed mode 
CHR(18) and 8 lines per inch CHR(27)+CHR(0)

the question about new Renderer it is because we can make a standard for 
print in ESC/P using FO also.

Would be interresting implement this?
Or 
Extend TXTRenderer to make this?

Clóvis
 Original Message 

On 21/03/02, 16:08:40, Art Welch [EMAIL PROTECTED] wrote regarding RE: 
How format to dot-matrix printers (ESC/P):


 My first suggestion would be to use Acrobat or something to print the 
PDFs.

 Second (or maybe it should be first) would be to use the AWT based print
 renderer to print to the printer. I have not used this, but shouldn't AWT 
be
 able to print to any printer for which it has a suitable driver. Maybe 
this
 works better under M$ Windows. Most of my work these days is with Unix 
and
 until recently on our systems AWT did not work well and when it did I 
think
 that it would only print PostScript. YMMV.

 Next if the formatting is not very fancy then I would suggest generating 
the
 text/ESCP using just XSLT (with an extension function for the special
 characters).

 The TXTRenderer assumes that the font for output does not change. Last 
time
 I checked ESC/P printers should accept plain ASCII text without the need 
for
 additional control codes (other than CR,LF). This is what the TXTRenderer
 produces. The problem is that with the exception of some special cases, 
the
 output produced by the TXTRenderer is UGLY.

 As to CHR(18) and CHR(27), I guess that may depend on how the XML parser
 interprets legal characters of Unicode and ISO/IEC 10646 (from the XML 
W3C
 Rec). Being below CHR(32) I suspect that they will probably be rejected 
as
 not a valid XML character.

 If you want pretty output and can not post process one of the current 
output
 formats then you are probably looking at a new renderer.

 Art

 -Original Message-
 From: Clóvis Wichoski [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, March 21, 2002 12:59 PM
 To: [EMAIL PROTECTED]
 Subject: How format to dot-matrix printers (ESC/P)


 Hi FOP team,

 I'm using FOP for generating PDF's, but now I need use FOP to generate
 text files (txt) for dot-matrix printers using Epson ESC/P, and I have
 following questions:

 1) I need create my own Renderer?
  if yes, what I need to share this with FOP-DEV

 2) Can I do this with TXTRenderer?
  if yes, How put chars like CHR(27) CHR(18) in txt?

 Best regards

 Clóvis Wichoski
 Supridatta


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]