Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-12 Thread Andreas L Delmelle

On Dec 11, 2005, at 22:49, J.Pietschmann wrote:


[EMAIL PROTECTED] wrote:

handler.startElement("", "", "root", atts);

   ^^
This doesn't look good. Try null here. Did you try to serialize
the generated XML?


Arrgh!! Leave it up to me to make the same mistake as the OP. Nice to  
see some people still think things through before posting. :-)


Sorry 'bout that.


Cheers,

Andreas

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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-12 Thread Jeremias Maerki
I just sent Peter back a corrected version of his code. Basically, I've
changed this:

- For SAX generation, the namespace URI must be null sein, not "null" or "".
- localName must be the same value as qName when no namespaces are used
like here

wrong:
handler.startElement("", "", "root", atts);
or: handler.startElement("null", "null", "root", atts);

right:
handler.startElement(null, "root", "root", atts);

- In the stylesheet I've replaced "/" in the template by "root". I never
use "/" on a template because I've run into problem myself then.

After these changes, it worked.

On 12.12.2005 09:19:10 Peter.Neu wrote:
> Hello,
> 
> I reworked the xml creation in the servlet but still the result is blank.
> Please have a look at the attached servlet and the stylesheet. 
> For the sake of visibility I refrain from posting it inside this mail :o)
> 
> cheers,
> 
> Pete
> 
> 
> > --- Ursprüngliche Nachricht ---
> > Von: "J.Pietschmann" <[EMAIL PROTECTED]>
> > An: fop-users@xmlgraphics.apache.org
> > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > Datum: Sun, 11 Dec 2005 22:49:15 +0100
> > 
> > [EMAIL PROTECTED] wrote:
> > > handler.startElement("", "", "root", atts);
> > ^^
> > This doesn't look good. Try null here. Did you try to serialize
> > the generated XML?
> > 
> > J.Pietschmann
> > 
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> -- 
> 10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
> +++ GMX - die erste Adresse für Mail, Message, More +++



Jeremias Maerki


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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-12 Thread Peter . Neu
Hello,

I reworked the xml creation in the servlet but still the result is blank.
Please have a look at the attached servlet and the stylesheet. 
For the sake of visibility I refrain from posting it inside this mail :o)

cheers,

Pete


> --- Ursprüngliche Nachricht ---
> Von: "J.Pietschmann" <[EMAIL PROTECTED]>
> An: fop-users@xmlgraphics.apache.org
> Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> Datum: Sun, 11 Dec 2005 22:49:15 +0100
> 
> [EMAIL PROTECTED] wrote:
> > handler.startElement("", "", "root", atts);
> ^^
> This doesn't look good. Try null here. Did you try to serialize
> the generated XML?
> 
> J.Pietschmann
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
+++ GMX - die erste Adresse für Mail, Message, More +++
http://www.w3.org/1999/XSL/Transform"; xmlns:fo="http://www.w3.org/1999/XSL/Format"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns:fn="http://www.w3.org/2004/07/xpath-functions"; xmlns:xdt="http://www.w3.org/2004/07/xpath-datatypes";>














  

 
   
   








BinaryStreamServlet.java
Description: Binary data
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-11 Thread J.Pietschmann

[EMAIL PROTECTED] wrote:

handler.startElement("", "", "root", atts);

   ^^
This doesn't look good. Try null here. Did you try to serialize
the generated XML?

J.Pietschmann

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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-09 Thread Andreas L Delmelle

On Dec 9, 2005, at 20:28, [EMAIL PROTECTED] wrote:


Are you using some kind of special parser? Or is this maybe a bug
in my fop version?
My configuration:


Errmm, you're right again. Sorry, no that's not it... By testing, I  
meant running the XSLT with an XML corresponding to the SAX events  
you're generating. Should've checked, but running the transformation  
with your original stylesheet, and the file input


hello

did work (as you already stated earlier on).

So, the problem isn't your XSLT --apart from the typo, as pointed out  
by Joerg--, neither the JAXPTransformWithSAX() method (at least not  
the part I suggested should be changed...)


Since the transformation doesn't use disable-output-escaping (also  
pointed out as a possible culprit), what does that leave us with...?


Anyone?

Cheers,

Andreas

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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-09 Thread Peter . Neu
Are you using some kind of special parser? Or is this maybe a bug
in my fop version? 
My configuration: 

Servlet:

handler.startElement("", "", "root", atts);
handler.startElement("", "", "Hello", atts);
handler.characters("Hello".toCharArray(), 0, "Hello".length());
handler.endElement("", "", "Hello");
handler.endElement("", "", "root");

XLS: 


 


xsl:for-each>

Or


 


xsl:for-each>

Or

  

Yields to the same blank page as before. This is getting stranger and
stranger.....

> --- Ursprüngliche Nachricht ---
> Von: Andreas L Delmelle <[EMAIL PROTECTED]>
> An: fop-users@xmlgraphics.apache.org
> Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> Datum: Fri, 9 Dec 2005 20:04:31 +0100
> 
> On Dec 9, 2005, at 19:56, [EMAIL PROTECTED] wrote:
> 
> > No offense taken ;o) Yes, I did correct the mistake.
> 
> Arrgh, *my* mistake...
> 
> 
> or
> 
> 
> should do the trick.
> 
> Tested and confirmed.
> 
> Cheers,
> 
> Andreas
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
+++ GMX - die erste Adresse für Mail, Message, More +++

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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-09 Thread Andreas L Delmelle

On Dec 9, 2005, at 20:04, Andreas L Delmelle wrote:


On Dec 9, 2005, at 19:56, [EMAIL PROTECTED] wrote:


No offense taken ;o) Yes, I did correct the mistake.


Arrgh, *my* mistake...


or



or


instead of match="/"

Phew! Finally :-)

Andreas


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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-09 Thread Andreas L Delmelle

On Dec 9, 2005, at 19:56, [EMAIL PROTECTED] wrote:


No offense taken ;o) Yes, I did correct the mistake.


Arrgh, *my* mistake...


or


should do the trick.

Tested and confirmed.

Cheers,

Andreas


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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-09 Thread Peter . Neu
No offense taken ;o) Yes, I did correct the mistake. 

Fo without input looks like this:

 http://www.w3.org/1999/XSL/Format"; 
xmlns:xdt="http://www.w3.org/2004/07/xpath-datatypes"; 
xmlns:fn="http://www.w3.org/2004/07/xpath-functions";

xmlns:xs="http://www.w3.org/2001/XMLSchema";>


fo with input looks like this (without for-each):

xml version="1.0" encoding="UTF-8"?> http://www.w3.org/1999/XSL/Format"; 
xmlns:xdt="http://www.w3.org/2004/07/xpath-datatypes"; 
xmlns:fn="http://www.w3.org/2004/07/xpath-functions";

xmlns:xs="http://www.w3.org/2001/XMLSchema";>hello

cheers,

Pete



> --- Ursprüngliche Nachricht ---
> Von: Andreas L Delmelle <[EMAIL PROTECTED]>
> An: fop-users@xmlgraphics.apache.org
> Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> Datum: Fri, 9 Dec 2005 19:45:53 +0100
> 
> On Dec 9, 2005, at 19:36, [EMAIL PROTECTED] wrote:
> 
> > Hi,
> >
> > for this test I used the stylesheet with the xsl:for-each tag. I  
> > was hoping
> > the transformation would pick up the xml tag with the input.
> 
> BTW: What do you mean by the FO not containing any xml input? Is  
> there nothing in the FO at all, not even the fo:root?
> 
> (and I dislike having to ask this question, but... You *did* correct  
> the typo --Hello, not hello--, right?)
> 
> Cheers,
> 
> Andreas
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
+++ GMX - die erste Adresse für Mail, Message, More +++

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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-09 Thread Andreas L Delmelle

On Dec 9, 2005, at 19:36, [EMAIL PROTECTED] wrote:


Hi,

for this test I used the stylesheet with the xsl:for-each tag. I  
was hoping

the transformation would pick up the xml tag with the input.


BTW: What do you mean by the FO not containing any xml input? Is  
there nothing in the FO at all, not even the fo:root?


(and I dislike having to ask this question, but... You *did* correct  
the typo --Hello, not hello--, right?)


Cheers,

Andreas


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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-09 Thread Peter . Neu
Hi,

for this test I used the stylesheet with the xsl:for-each tag. I was hoping 
the transformation would pick up the xml tag with the input.

I'm also 100% clueless...

cheers,
Pete 

> --- Ursprüngliche Nachricht ---
> Von: Andreas L Delmelle <[EMAIL PROTECTED]>
> An: fop-users@xmlgraphics.apache.org
> Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> Datum: Fri, 9 Dec 2005 19:19:49 +0100
> 
> On Dec 9, 2005, at 18:41, [EMAIL PROTECTED] wrote:
> 
> Pete,
> 
> > I just added a root node. But it has no effect on the  
> > transformation both
> > the fo and pdf do not conatain any xml input. It seems the xsl
> > tranformation just ignores the "hello" tag.
> 
> Is that the stylesheet with or without the xsl:for-each?
> If it's the one where you removed the for-each, then this would make  
> sense, as there is no template defined that matches Hello elements...  
> If not, then I'm currently at a loss as to what the cause may be.
> 
> Cheers,
> 
> Andreas
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
GMX DSL-Flatrate 1 Jahr kostenlos* + WLAN-Router ab 0,- Euro*
Bis 31.12.2005 einsteigen! Infos unter: http://www.gmx.net/de/go/dsl

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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-09 Thread Andreas L Delmelle

On Dec 9, 2005, at 18:41, [EMAIL PROTECTED] wrote:

Pete,

I just added a root node. But it has no effect on the  
transformation both

the fo and pdf do not conatain any xml input. It seems the xsl
tranformation just ignores the "hello" tag.


Is that the stylesheet with or without the xsl:for-each?
If it's the one where you removed the for-each, then this would make  
sense, as there is no template defined that matches Hello elements...  
If not, then I'm currently at a loss as to what the cause may be.


Cheers,

Andreas


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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-09 Thread Peter . Neu
Hi,

I just added a root node. But it has no effect on the transformation both
the fo and pdf do not conatain any xml input. It seems the xsl
tranformation just ignores the "hello" tag.

cheers,
Pete


> --- Ursprüngliche Nachricht ---
> Von: Andreas L Delmelle <[EMAIL PROTECTED]>
> An: fop-users@xmlgraphics.apache.org
> Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> Datum: Fri, 9 Dec 2005 18:21:07 +0100
> 
> On Dec 9, 2005, at 18:03, [EMAIL PROTECTED] wrote:
> 
> Hi Peter,
> 
> > It seems that the source of the evil bug is not the typo but the  
> > for-each
> > tag like Andreas suggested. I removed it and voilá some output on the
> > screen. I looked at the fo document and it seems ok. So back to the  
> > orginal
> > question what is wrong here?
> >
> > I used a dozen for-each tags in another setup where I wrote the xml  
> > document
> > to the file system and the output to pdf was no problem. What is  
> > different here?
> 
> Could the problem be that the Hello element currently is the root  
> node of your document (as I suspected)?
> 
> In that case, don't change the stylesheet, but modify your Java code to:
> 
> handler.startElement("", "", "root", atts);
> handler.startElement("", "", "Hello", atts);
> ...
> handler.endElement("Hello");
> handler.endElement("root");
> 
> (IIRC, startDocument() simply doesn't magically create a root node  
> for you...)
> 
> 
> HTH!
> 
> 
> Cheers,
> 
> Andreas
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
Telefonieren Sie schon oder sparen Sie noch?
NEU: GMX Phone_Flat http://www.gmx.net/de/go/telefonie

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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-09 Thread Andreas L Delmelle

On Dec 9, 2005, at 18:03, [EMAIL PROTECTED] wrote:

Hi Peter,

It seems that the source of the evil bug is not the typo but the  
for-each

tag like Andreas suggested. I removed it and voilá some output on the
screen. I looked at the fo document and it seems ok. So back to the  
orginal

question what is wrong here?

I used a dozen for-each tags in another setup where I wrote the xml  
document
to the file system and the output to pdf was no problem. What is  
different here?


Could the problem be that the Hello element currently is the root  
node of your document (as I suspected)?


In that case, don't change the stylesheet, but modify your Java code to:

handler.startElement("", "", "root", atts);
handler.startElement("", "", "Hello", atts);
...
handler.endElement("Hello");
handler.endElement("root");

(IIRC, startDocument() simply doesn't magically create a root node  
for you...)



HTH!


Cheers,

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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-09 Thread Peter . Neu
Hello,

thanks for the many comments. I corrected the typo in the hello tag.
This minimal configuration was my intention in the first place because the
only thing I need, is to establish the pipeline from the creation of xml
document to the pdf output.

It seems that the source of the evil bug is not the typo but the for-each
tag like Andreas suggested. I removed it and voilá some output on the
screen. I looked at the fo document and it seems ok. So back to the orginal
question what is wrong here? I used a dozen for-each tags in another setup
where I wrote the xml document to the file system and the output to pdf was
no problem. What is different here? I seems to me I'm missing something very
important...

If it is not too much trouble can somebody try to run the servlet with xsl
document(I posted it earlier) on their box? I may be the only way to find
this mistake. 

cheers,
Pete


> --- Ursprüngliche Nachricht ---
> Von: Andreas L Delmelle <[EMAIL PROTECTED]>
> An: fop-users@xmlgraphics.apache.org
> Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> Datum: Fri, 9 Dec 2005 04:25:33 +0100
> 
> On Dec 8, 2005, at 21:58, J.Pietschmann wrote:
> 
> > Andreas L Delmelle wrote:
> >> of your XML data shows up in the result document... AFAICT, your  
> >> source XML contains only:
> >> Hello
> >> To this you apply templates and create the root.
> >
> > There is a  around the fo:inline. Note the
> > spelling mismatch, ...
> 
> Ouch! Totally missed that one. It's A Good Thing there's more than  
> two eyes watching the list :-)
> 
> Cheers,
> 
> Andreas
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
Telefonieren Sie schon oder sparen Sie noch?
NEU: GMX Phone_Flat http://www.gmx.net/de/go/telefonie

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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-08 Thread Andreas L Delmelle

On Dec 8, 2005, at 21:58, J.Pietschmann wrote:


Andreas L Delmelle wrote:
of your XML data shows up in the result document... AFAICT, your  
source XML contains only:

Hello
To this you apply templates and create the root.


There is a  around the fo:inline. Note the
spelling mismatch, ...


Ouch! Totally missed that one. It's A Good Thing there's more than  
two eyes watching the list :-)


Cheers,

Andreas


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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-08 Thread J.Pietschmann

Andreas L Delmelle wrote:
of your XML data shows up in the result document... AFAICT, your source 
XML contains only:


Hello

To this you apply templates and create the root.


There is a  around the fo:inline. Note the
spelling mismatch, therefore it selects nothing -> no content to
watch.

J.Pietschmann


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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-08 Thread J.Pietschmann

[EMAIL PROTECTED] wrote:

OK, the ByteArrayOutputStream solves the NullPointer Exception. The only
problem left is there is none of my xml data in the pdf. I only get the
static header of the xsl document :o/


The most likely reason is that you don't generate FO objects
for the real content. If the PDF generation worked before,
using serialization of the intermediate XML, then you've
probably tried to "generate tags".
The easies way to track down the problem is to replace the
FOP Driver by an identity transformation which serializes to
the servlet's output stream so that you can download the
FO document with a browser (or, better, using a command line
client to save it into a file). It the FO looks ok, and
produces the expected output if run through the FOP command
lien application, check whether your transformation uses
disable-output-escaping.

J.Pietschmann

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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-08 Thread Andreas L Delmelle

On Dec 8, 2005, at 20:25, [EMAIL PROTECTED] wrote:


Hi,

thanks for the advice I split up the transformation but couldn't find
anything wrong.

The xslt file misses in the output the template & style tags but I  
suppose

that's ok.


Depends on what do you mean by "OK"? Your XSLT doesn't contain any  
templates other than one matching the root node of your source XML.  
Did you leave the others out intentionally? If not, that explains why  
none of your XML data shows up in the result document... AFAICT, your  
source XML contains only:


Hello

To this you apply templates and create the root. Then, the XSLT  
processor goes looking for Hello element nodes to iterate over, but  
doesn't find any... The only child node is a Hello text node.


IIC: try removing the xsl:for-each, and you should at least get some  
result...



HTH!

Cheers,

Andreas



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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-08 Thread Peter . Neu
Hi,

thanks for the advice I split up the transformation but couldn't find
anything wrong. 

The xslt file misses in the output the template & style tags but I suppose
that's ok. I got rid of the complicated XmlTransformer and pasted the xml
creation directly into the servlet but still no luck. So I have reduced
everything to it's most basic components but I still don't see what's wrong.
Just to be sure I attached the servlet and the xls sheet (created & tested
in Stylevision). 

Do you see anyhing wrong?

cheers,
Pete


> --- Ursprüngliche Nachricht ---
> Von: Jeremias Maerki <[EMAIL PROTECTED]>
> An: fop-users@xmlgraphics.apache.org
> Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> Datum: Thu, 08 Dec 2005 16:25:01 +0100
> 
> Nothing's wrong with the sequence. Now that you've got a complete
> processing pipeline there and you have problems, you have to split it up
> at defined points to get at the intermediate results so you can identify
> the problem. For example:
> 
> Instead of...
> SAXResult result = new SAXResult(driver.getContentHandler());
> ...you can use...
> StreamResult result = new StreamResult(new File("C:/Temp/temp.xml"));
> 
> That will write the output from the XSLT transformation to a file which
> you can inspect. If you want to see what the XML you produce looks like,
> switch from XSLT transformation to identity transformation
> (newTransformerHandler())
> to skip the XSLT stage.
> 
> You've probably got a bug in your XSLT. Now it's your turn.
> 
> On 08.12.2005 16:18:51 Peter.Neu wrote:
> > OK, the ByteArrayOutputStream solves the NullPointer Exception. The only
> > problem left is there is none of my xml data in the pdf. I only get the
> > static header of the xsl document :o/
> > 
> > Do we have to change the sequence somehow?
> 
> Jeremias Maerki
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
GMX DSL-Flatrate 1 Jahr kostenlos* + WLAN-Router ab 0,- Euro*
Bis 31.12.2005 einsteigen! Infos unter: http://www.gmx.net/de/go/dsl
http://www.w3.org/1999/XSL/Transform"; xmlns:fo="http://www.w3.org/1999/XSL/Format"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns:fn="http://www.w3.org/2004/07/xpath-functions"; xmlns:xdt="http://www.w3.org/2004/07/xpath-datatypes";>



























BinaryStreamServlet.java
Description: Binary data
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-08 Thread Jeremias Maerki
Nothing's wrong with the sequence. Now that you've got a complete
processing pipeline there and you have problems, you have to split it up
at defined points to get at the intermediate results so you can identify
the problem. For example:

Instead of...
SAXResult result = new SAXResult(driver.getContentHandler());
...you can use...
StreamResult result = new StreamResult(new File("C:/Temp/temp.xml"));

That will write the output from the XSLT transformation to a file which
you can inspect. If you want to see what the XML you produce looks like,
switch from XSLT transformation to identity transformation 
(newTransformerHandler())
to skip the XSLT stage.

You've probably got a bug in your XSLT. Now it's your turn.

On 08.12.2005 16:18:51 Peter.Neu wrote:
> OK, the ByteArrayOutputStream solves the NullPointer Exception. The only
> problem left is there is none of my xml data in the pdf. I only get the
> static header of the xsl document :o/
> 
> Do we have to change the sequence somehow?

Jeremias Maerki


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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-08 Thread Peter . Neu
OK, the ByteArrayOutputStream solves the NullPointer Exception. The only
problem left is there is none of my xml data in the pdf. I only get the
static header of the xsl document :o/

Do we have to change the sequence somehow?




> --- Ursprüngliche Nachricht ---
> Von: Jeremias Maerki <[EMAIL PROTECTED]>
> An: fop-users@xmlgraphics.apache.org
> Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> Datum: Thu, 08 Dec 2005 16:04:32 +0100
> 
> I'm not sure why you get an error that "handler is null". The setup
> looks ok now. The only thing that's missing is the ByteArrayOutputStream
> that FOP writes the PDF output to. In order to make PDF displaying work
> you need to know the size of the PDF so there's no way around buffering
> the PDF into a byte array. See some changes inline below.
> 
> On 08.12.2005 15:50:48 Peter.Neu wrote:
> > First of all. Thanks for taking so much time for my problem :o)
> > 
> > I tried to include your code. It's attached below:
> > 
> > 1. the transformer factory with the implementation I use does not
> support
> > this call: this.transformerFactory.newTransformerHandler(xsltSrc); - so
> I
> > modified it a bit.
> > 
> > 2. When I run the code I get the error that the handler is null :o/
> > 
> > 3. I'm still not sure how to output the stuff to the browser.
> > 
> > cheers,
> > Pete
> > 
> > Code:
> > 
> > SAXTransformerFactory tf = (SAXTransformerFactory)
> > SAXTransformerFactory.newInstance();
> > // my static xsl file in here
> > Source xsltSrc = new StreamSource((new
> > File(session.getServletContext().getRealPath("/xml/nbw.xsl";
> > TransformerHandler handler = tf.newTransformerHandler(xsltSrc);
> > 
> > //Prepare FOP here
> > Driver driver = new Driver();
> > driver.setLogger(this.log2);
> > driver.setRenderer(Driver.RENDER_PDF);
> > 
> //Setup a buffer to obtain the content length
> //Use the ByteArrayOutputStream from Jakarta Commons IO. It's more
> //memory-efficient
> ByteArrayOutputStream out2 = new ByteArrayOutputStream();
> driver.setOutputStream(out2);
> > 
> > SAXResult result = new SAXResult(driver.getContentHandler());
> > handler.setResult(result);
> > 
> > 
> > XmlTransformer xmlt = new XmlTransformer();
> > xmlt.doXMLTransform(handler);
> > /* this  is nothing but
> > *   handler.startDocument();
> > handerl.startElement("BLA");
> > handerl.endElement("BLA");
> > hd.endDocument();
> > */
> > 
> > //Prepare response
> > response.setContentType("application/pdf");
> > //  response.setContentLength(out2.size());
> > 
> > //Send content to Browser
> 
> response.getOutputStream().write(out2.toByteArray());
> 
> > response.getOutputStream().flush();
> > 
> > 
> > -
> > 
> > > --- Ursprüngliche Nachricht ---
> > > Von: Jeremias Maerki <[EMAIL PROTECTED]>
> > > An: fop-users@xmlgraphics.apache.org
> > > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > > Datum: Thu, 08 Dec 2005 14:53:19 +0100
> > > 
> > > It's unclear what this XmlTransformer does exactly. You only
> instantiate
> > > a new instance but you do nothing with it.
> > > 
> > > Anyway, I'll try to rework your code so you can pipe this stuff
> > > together:
> > > 
> > > 1. You don't need the FileOutputStream anymore.
> > > 2. No need to configure the serializer if you just pipe the stuff
> > > through.
> > > 3. Since you do only an identity transform you don't need the first
> > > TransformerHandler. Instead set up the XSLT transformation as a
> > > TransformerHandler.
> > > 
> > > SAXTransformerFactory tf =
> > > (SAXTransformerFactory)SAXTransformerFactory.newInstance();
> > > 
> > > // my static xsl file in here
> > > Source xsltSrc = new StreamSource((new File(("nbw.xsl";
> > > TransformerHandler handler =
> > > this.transformerFactory.newTransformerHandler(xsltSrc);
> > > 
> > > //Prepare FOP here
> > > 
> > > SAXResult result = new SAXResult(driver.getContentHandler());
> > > handler.setResult(streamResult);
> > > 
> > > XmlTransformer xmlt = new XmlTransformer(handler);
> > > //Start the XML generation, however you do this (see question above)
> > > xmlt.doSomething();

Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-08 Thread Jeremias Maerki
I'm not sure why you get an error that "handler is null". The setup
looks ok now. The only thing that's missing is the ByteArrayOutputStream
that FOP writes the PDF output to. In order to make PDF displaying work
you need to know the size of the PDF so there's no way around buffering
the PDF into a byte array. See some changes inline below.

On 08.12.2005 15:50:48 Peter.Neu wrote:
> First of all. Thanks for taking so much time for my problem :o)
> 
> I tried to include your code. It's attached below:
> 
> 1. the transformer factory with the implementation I use does not support
> this call: this.transformerFactory.newTransformerHandler(xsltSrc); - so I
> modified it a bit.
> 
> 2. When I run the code I get the error that the handler is null :o/
> 
> 3. I'm still not sure how to output the stuff to the browser.
> 
> cheers,
> Pete
> 
> Code:
> 
> SAXTransformerFactory tf = (SAXTransformerFactory)
> SAXTransformerFactory.newInstance();
> // my static xsl file in here
> Source xsltSrc = new StreamSource((new
> File(session.getServletContext().getRealPath("/xml/nbw.xsl";
> TransformerHandler handler = tf.newTransformerHandler(xsltSrc);
> 
> //Prepare FOP here
> Driver driver = new Driver();
> driver.setLogger(this.log2);
> driver.setRenderer(Driver.RENDER_PDF);
> 
//Setup a buffer to obtain the content length
//Use the ByteArrayOutputStream from Jakarta Commons IO. It's more
//memory-efficient
ByteArrayOutputStream out2 = new ByteArrayOutputStream();
driver.setOutputStream(out2);
> 
> SAXResult result = new SAXResult(driver.getContentHandler());
> handler.setResult(result);
> 
> 
> XmlTransformer xmlt = new XmlTransformer();
> xmlt.doXMLTransform(handler);
> /* this  is nothing but
> *   handler.startDocument();
> handerl.startElement("BLA");
> handerl.endElement("BLA");
> hd.endDocument();
> */
> 
> //Prepare response
> response.setContentType("application/pdf");
> //  response.setContentLength(out2.size());
> 
> //Send content to Browser

response.getOutputStream().write(out2.toByteArray());

> response.getOutputStream().flush();
> 
> 
> -------------
> 
> > --- Ursprüngliche Nachricht ---
> > Von: Jeremias Maerki <[EMAIL PROTECTED]>
> > An: fop-users@xmlgraphics.apache.org
> > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > Datum: Thu, 08 Dec 2005 14:53:19 +0100
> > 
> > It's unclear what this XmlTransformer does exactly. You only instantiate
> > a new instance but you do nothing with it.
> > 
> > Anyway, I'll try to rework your code so you can pipe this stuff
> > together:
> > 
> > 1. You don't need the FileOutputStream anymore.
> > 2. No need to configure the serializer if you just pipe the stuff
> > through.
> > 3. Since you do only an identity transform you don't need the first
> > TransformerHandler. Instead set up the XSLT transformation as a
> > TransformerHandler.
> > 
> > SAXTransformerFactory tf =
> > (SAXTransformerFactory)SAXTransformerFactory.newInstance();
> > 
> > // my static xsl file in here
> > Source xsltSrc = new StreamSource((new File(("nbw.xsl";
> > TransformerHandler handler =
> > this.transformerFactory.newTransformerHandler(xsltSrc);
> > 
> > //Prepare FOP here
> > 
> > SAXResult result = new SAXResult(driver.getContentHandler());
> > handler.setResult(streamResult);
> > 
> > XmlTransformer xmlt = new XmlTransformer(handler);
> > //Start the XML generation, however you do this (see question above)
> > xmlt.doSomething();
> > 
> > This should send the SAX events generated by your XmlTransformer (not an
> > ideal name IMO) through the TransformerHandler (for the XSLT transform)
> > and its output further on to FOP.
> > 
> > On 08.12.2005 14:31:23 Peter.Neu wrote:
> > > protected void JAXPTransform(HttpSession session,
> > HttpServletResponse response, HttpServletRequest req) throws Exception {
> > > 
> > > 
> > > // Here I provide a file output stream for the result of the sax
> > transformation -> what I need is some kind of stream
> > >   
> > > File xmlfile = new
> > File(session.getServletContext().getRealPath("/xml/"), "nbw.xml");
> > > OutputStream out = new java.io.FileOutputStream(xmlfile);
> > > 
> > > // set the stream result for the transformation
> > > StreamResult str

Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-08 Thread Peter . Neu
First of all. Thanks for taking so much time for my problem :o)

I tried to include your code. It's attached below:

1. the transformer factory with the implementation I use does not support
this call: this.transformerFactory.newTransformerHandler(xsltSrc); - so I
modified it a bit.

2. When I run the code I get the error that the handler is null :o/

3. I'm still not sure how to output the stuff to the browser.

cheers,
Pete

Code:

SAXTransformerFactory tf = (SAXTransformerFactory)
SAXTransformerFactory.newInstance();
// my static xsl file in here
Source xsltSrc = new StreamSource((new
File(session.getServletContext().getRealPath("/xml/nbw.xsl";
TransformerHandler handler = tf.newTransformerHandler(xsltSrc);

//Prepare FOP here
Driver driver = new Driver();
driver.setLogger(this.log2);
driver.setRenderer(Driver.RENDER_PDF);


SAXResult result = new SAXResult(driver.getContentHandler());
handler.setResult(result);


XmlTransformer xmlt = new XmlTransformer();
xmlt.doXMLTransform(handler);
/* this  is nothing but
*   handler.startDocument();
handerl.startElement("BLA");
handerl.endElement("BLA");
hd.endDocument();
*/

//Prepare response
response.setContentType("application/pdf");
//  response.setContentLength(out2.size());

//Send content to Browser
//response.getOutputStream().write(out2.toByteArray());
response.getOutputStream().flush();


-

> --- Ursprüngliche Nachricht ---
> Von: Jeremias Maerki <[EMAIL PROTECTED]>
> An: fop-users@xmlgraphics.apache.org
> Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> Datum: Thu, 08 Dec 2005 14:53:19 +0100
> 
> It's unclear what this XmlTransformer does exactly. You only instantiate
> a new instance but you do nothing with it.
> 
> Anyway, I'll try to rework your code so you can pipe this stuff
> together:
> 
> 1. You don't need the FileOutputStream anymore.
> 2. No need to configure the serializer if you just pipe the stuff
> through.
> 3. Since you do only an identity transform you don't need the first
> TransformerHandler. Instead set up the XSLT transformation as a
> TransformerHandler.
> 
> SAXTransformerFactory tf =
> (SAXTransformerFactory)SAXTransformerFactory.newInstance();
> 
> // my static xsl file in here
> Source xsltSrc = new StreamSource((new File(("nbw.xsl";
> TransformerHandler handler =
> this.transformerFactory.newTransformerHandler(xsltSrc);
> 
> //Prepare FOP here
> 
> SAXResult result = new SAXResult(driver.getContentHandler());
> handler.setResult(streamResult);
> 
> XmlTransformer xmlt = new XmlTransformer(handler);
> //Start the XML generation, however you do this (see question above)
> xmlt.doSomething();
> 
> This should send the SAX events generated by your XmlTransformer (not an
> ideal name IMO) through the TransformerHandler (for the XSLT transform)
> and its output further on to FOP.
> 
> On 08.12.2005 14:31:23 Peter.Neu wrote:
> > protected void JAXPTransform(HttpSession session,
> HttpServletResponse response, HttpServletRequest req) throws Exception {
> > 
> > 
> > // Here I provide a file output stream for the result of the sax
> transformation -> what I need is some kind of stream
> >   
> > File xmlfile = new
> File(session.getServletContext().getRealPath("/xml/"), "nbw.xml");
> > OutputStream out = new java.io.FileOutputStream(xmlfile);
> > 
> > // set the stream result for the transformation
> > StreamResult streamResult = new StreamResult((out));
> > SAXTransformerFactory tf = (SAXTransformerFactory)
> SAXTransformerFactory.newInstance();
> > TransformerHandler hd = tf.newTransformerHandler();
> > Transformer serializer = hd.getTransformer();
> > 
> > serializer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
> > serializer.setOutputProperty(OutputKeys.INDENT, "yes");
> > 
> > hd.setResult(streamResult);
> > 
> > // the whole creation of the xml is done in the XmlTransformer
> which writes to the output file but should write it to some kind of stream
> > XmlTransformer xmlt = new XmlTransformer(hd);
> > 
> > //from here on just the basic servlet example from here : 
> > // http://xmlgraphics.apache.org/fop/0.20.5/servlets.html#xslt
> > Driver driver = new Driver();
> > driver.setLogger(this.log2);
> > driver.setRenderer(Driver.RENDER_PDF);
> > 
> > //Se

Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-08 Thread Jeremias Maerki
It's unclear what this XmlTransformer does exactly. You only instantiate
a new instance but you do nothing with it.

Anyway, I'll try to rework your code so you can pipe this stuff
together:

1. You don't need the FileOutputStream anymore.
2. No need to configure the serializer if you just pipe the stuff
through.
3. Since you do only an identity transform you don't need the first
TransformerHandler. Instead set up the XSLT transformation as a
TransformerHandler.

SAXTransformerFactory tf = 
(SAXTransformerFactory)SAXTransformerFactory.newInstance();

// my static xsl file in here
Source xsltSrc = new StreamSource((new File(("nbw.xsl";
TransformerHandler handler = 
this.transformerFactory.newTransformerHandler(xsltSrc);

//Prepare FOP here

SAXResult result = new SAXResult(driver.getContentHandler());
handler.setResult(streamResult);

XmlTransformer xmlt = new XmlTransformer(handler);
//Start the XML generation, however you do this (see question above)
xmlt.doSomething();

This should send the SAX events generated by your XmlTransformer (not an
ideal name IMO) through the TransformerHandler (for the XSLT transform)
and its output further on to FOP.

On 08.12.2005 14:31:23 Peter.Neu wrote:
> protected void JAXPTransform(HttpSession session, HttpServletResponse 
> response, HttpServletRequest req) throws Exception {
> 
> 
> // Here I provide a file output stream for the result of the sax 
> transformation -> what I need is some kind of stream
>   
> File xmlfile = new 
> File(session.getServletContext().getRealPath("/xml/"), "nbw.xml");
> OutputStream out = new java.io.FileOutputStream(xmlfile);
> 
> // set the stream result for the transformation
> StreamResult streamResult = new StreamResult((out));
> SAXTransformerFactory tf = (SAXTransformerFactory) 
> SAXTransformerFactory.newInstance();
> TransformerHandler hd = tf.newTransformerHandler();
> Transformer serializer = hd.getTransformer();
> 
> serializer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
> serializer.setOutputProperty(OutputKeys.INDENT, "yes");
> 
> hd.setResult(streamResult);
> 
> // the whole creation of the xml is done in the XmlTransformer which 
> writes to the output file but should write it to some kind of stream
> XmlTransformer xmlt = new XmlTransformer(hd);
> 
> //from here on just the basic servlet example from here : 
> // http://xmlgraphics.apache.org/fop/0.20.5/servlets.html#xslt
> Driver driver = new Driver();
> driver.setLogger(this.log2);
> driver.setRenderer(Driver.RENDER_PDF);
> 
> //Setup a buffer to obtain the content length
> ByteArrayOutputStream out2 = new ByteArrayOutputStream();
> driver.setOutputStream(out2);
> 
> //Setup Transformer
> BufferedReader r = req.getReader();
> 
> 
> this.transformerFactory = TransformerFactory.newInstance();
> 
> // my static xsl file in here
> Source xsltSrc = new StreamSource((new File(("nbw.xsl";
> Transformer transformer = 
> this.transformerFactory.newTransformer(xsltSrc);
> 
> //Make sure the XSL transformation's result is piped through to FOP
> Result res = new SAXResult(driver.getContentHandler());
> 
> //Setup input
> // This is the point where im stuck -> I don't know how to insert a 
> stream in here
>Source src = new StreamSource(new File("foo.xml"));
> 
> //Start the transformation and rendering process
> transformer.transform(src, res);
> 
> //Prepare response
> response.setContentType("application/pdf");
> response.setContentLength(out2.size());
> 
> //Send content to Browser
> response.getOutputStream().write(out2.toByteArray());
> response.getOutputStream().flush();
> 
> 
> }



Jeremias Maerki


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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-08 Thread Peter . Neu
Hi,

sorry maybe I created a little misunderstanding here. I attached some source
code as a .txt file to clear up things.

cheers,
Pete




> --- Ursprüngliche Nachricht ---
> Von: Jeremias Maerki <[EMAIL PROTECTED]>
> An: fop-users@xmlgraphics.apache.org
> Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> Datum: Thu, 08 Dec 2005 14:13:03 +0100
> 
> Can you please give a little more context (i.e. more code)? I don't
> understand what exactly you want to do. I thought you had a SAX XML
> source, not an XML file source.
> 
> On 08.12.2005 13:56:27 Peter.Neu wrote:
> > Hello,
> > 
> > I have a hard time getting the Obj2Pdf Example to work with my
> application.
> > I was browsing through the FAQ and found another example 
> > 
> > http://xmlgraphics.apache.org/fop/0.20.5/servlets.html#xslt
> > 
> > But also here is the problem I don't know how to pass the generated xml
> file
> > to a File object. 
> > 
> > The critical line is this one: 
> > Source src = new StreamSource(new File("foo.xml")); <- Streaming?
> > 
> > How can I stream my xml document in this object? My transformation is a
> > simple SAX transformation.
> > 
> > cheers,
> > Pete
> > 
> > 
> > > --- Ursprüngliche Nachricht ---
> > > Von: [EMAIL PROTECTED]
> > > An: fop-users@xmlgraphics.apache.org
> > > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > > Datum: Thu, 8 Dec 2005 08:54:10 +0100 (MET)
> > > 
> > > Hello Jeremias,
> > > 
> > > good your are in the cet time zone,too ;o). 
> > > My code also uses sax so the refactoring process will not be that
> long.
> > > Anyway it's always good to have a working example so I'll adapt to
> that. 
> > > I'll be back with details when I'm done refactoring.
> > > 
> > > cheers,
> > > Pete
> > > 
> > > 
> > > 
> > > 
> > > > --- Ursprüngliche Nachricht ---
> > > > Von: Jeremias Maerki <[EMAIL PROTECTED]>
> > > > An: fop-users@xmlgraphics.apache.org
> > > > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > > > Datum: Thu, 08 Dec 2005 08:32:55 +0100
> > > > 
> > > > Pete,
> > > > 
> > > > I see. No, in this case you're not missing anything although you may
> not
> > > > need to rewrite your whole code just to accomodate the new pattern.
> > > > Generating XML using SAX events is one way to generate XML, a good
> way
> > > > but not necessarily the only one. Remember that JAXP is quite
> flexible
> > > > and that you could use a DOMSource, for example, if you've already
> got
> > > > code that generates a DOM from your data. The purpose of the
> examples in
> > > > the examples/embedding directory are to show a gradual approach to
> the
> > > > patterns that we suggest people use. The benefit out of this is a
> > > > flexible and quick solution.
> > > > 
> > > > On 08.12.2005 08:20:49 Peter.Neu wrote:
> > > > > Hi Jeremias,
> > > > > 
> > > > > I was refering to Obj2PDF because this is the only example which
> shows
> > > > how
> > > > > to generate XML and then pass it to the FOP Transformation.
> XML2PDF
> > > > works
> > > > > with a static and already existing xml file. So the whole point
> was
> > > how
> > > > to
> > > > > pass a generated xml file to fop without writing it to the file
> > > system.
> > > > > Using the Obj2PDF requires a lot of refactoring in my code but
> that is
> > > > the
> > > > > only option I got I suppose, or am I missing something?
> > > > > 
> > > > > cheers,
> > > > > Pete 
> > > > > 
> > > > > > --- Ursprüngliche Nachricht ---
> > > > > > Von: Jeremias Maerki <[EMAIL PROTECTED]>
> > > > > > An: fop-users@xmlgraphics.apache.org
> > > > > > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > > > > > Datum: Wed, 07 Dec 2005 21:44:38 +0100
> > > > > > 
> > > > > > Yes, that's basically it, though ExampleObj2PDF is a bit
> special.
> > > > > > ExampleXML2PDF is the more generic example. And yes, it works in
> a
> > > > > > webapp.
>

Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-08 Thread Jeremias Maerki
Can you please give a little more context (i.e. more code)? I don't
understand what exactly you want to do. I thought you had a SAX XML
source, not an XML file source.

On 08.12.2005 13:56:27 Peter.Neu wrote:
> Hello,
> 
> I have a hard time getting the Obj2Pdf Example to work with my application.
> I was browsing through the FAQ and found another example 
> 
> http://xmlgraphics.apache.org/fop/0.20.5/servlets.html#xslt
> 
> But also here is the problem I don't know how to pass the generated xml file
> to a File object. 
> 
> The critical line is this one: 
> Source src = new StreamSource(new File("foo.xml")); <- Streaming?
> 
> How can I stream my xml document in this object? My transformation is a
> simple SAX transformation.
> 
> cheers,
> Pete
> 
> 
> > --- Ursprüngliche Nachricht ---
> > Von: [EMAIL PROTECTED]
> > An: fop-users@xmlgraphics.apache.org
> > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > Datum: Thu, 8 Dec 2005 08:54:10 +0100 (MET)
> > 
> > Hello Jeremias,
> > 
> > good your are in the cet time zone,too ;o). 
> > My code also uses sax so the refactoring process will not be that long.
> > Anyway it's always good to have a working example so I'll adapt to that. 
> > I'll be back with details when I'm done refactoring.
> > 
> > cheers,
> > Pete
> > 
> > 
> > 
> > 
> > > --- Ursprüngliche Nachricht ---
> > > Von: Jeremias Maerki <[EMAIL PROTECTED]>
> > > An: fop-users@xmlgraphics.apache.org
> > > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > > Datum: Thu, 08 Dec 2005 08:32:55 +0100
> > > 
> > > Pete,
> > > 
> > > I see. No, in this case you're not missing anything although you may not
> > > need to rewrite your whole code just to accomodate the new pattern.
> > > Generating XML using SAX events is one way to generate XML, a good way
> > > but not necessarily the only one. Remember that JAXP is quite flexible
> > > and that you could use a DOMSource, for example, if you've already got
> > > code that generates a DOM from your data. The purpose of the examples in
> > > the examples/embedding directory are to show a gradual approach to the
> > > patterns that we suggest people use. The benefit out of this is a
> > > flexible and quick solution.
> > > 
> > > On 08.12.2005 08:20:49 Peter.Neu wrote:
> > > > Hi Jeremias,
> > > > 
> > > > I was refering to Obj2PDF because this is the only example which shows
> > > how
> > > > to generate XML and then pass it to the FOP Transformation. XML2PDF
> > > works
> > > > with a static and already existing xml file. So the whole point was
> > how
> > > to
> > > > pass a generated xml file to fop without writing it to the file
> > system.
> > > > Using the Obj2PDF requires a lot of refactoring in my code but that is
> > > the
> > > > only option I got I suppose, or am I missing something?
> > > > 
> > > > cheers,
> > > > Pete 
> > > > 
> > > > > --- Ursprüngliche Nachricht ---
> > > > > Von: Jeremias Maerki <[EMAIL PROTECTED]>
> > > > > An: fop-users@xmlgraphics.apache.org
> > > > > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > > > > Datum: Wed, 07 Dec 2005 21:44:38 +0100
> > > > > 
> > > > > Yes, that's basically it, though ExampleObj2PDF is a bit special.
> > > > > ExampleXML2PDF is the more generic example. And yes, it works in a
> > > > > webapp.
> > > > > 
> > > > > On 07.12.2005 21:39:58 Peter.Neu wrote:
> > > > > > Hi Glenn
> > > > > > 
> > > > > > did you mean this example? Taken from [1]. Does this work in a
> > > webapp?
> > > > > > 
> > > > > > 
> > > > > > //Setup output
> > > > > > OutputStream out = new java.io.FileOutputStream(pdf);
> > > > > >   try {
> > > > > >   driver.setOutputStream(out);
> > > > > >   //Setup XSLT
> > > > > >   TransformerFactory factory =
> > TransformerFactory.newInstance();
> > > > > >   Transformer transformer = factory.newTransformer(new    
> >  
> > >
> > > > > > StreamSource(xslt));
> > > > > >

Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-08 Thread Peter . Neu
Hello,

I have a hard time getting the Obj2Pdf Example to work with my application.
I was browsing through the FAQ and found another example 

http://xmlgraphics.apache.org/fop/0.20.5/servlets.html#xslt

But also here is the problem I don't know how to pass the generated xml file
to a File object. 

The critical line is this one: 
Source src = new StreamSource(new File("foo.xml")); <- Streaming?

How can I stream my xml document in this object? My transformation is a
simple SAX transformation.

cheers,
Pete


> --- Ursprüngliche Nachricht ---
> Von: [EMAIL PROTECTED]
> An: fop-users@xmlgraphics.apache.org
> Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> Datum: Thu, 8 Dec 2005 08:54:10 +0100 (MET)
> 
> Hello Jeremias,
> 
> good your are in the cet time zone,too ;o). 
> My code also uses sax so the refactoring process will not be that long.
> Anyway it's always good to have a working example so I'll adapt to that. 
> I'll be back with details when I'm done refactoring.
> 
> cheers,
> Pete
> 
> 
> 
> 
> > --- Ursprüngliche Nachricht ---
> > Von: Jeremias Maerki <[EMAIL PROTECTED]>
> > An: fop-users@xmlgraphics.apache.org
> > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > Datum: Thu, 08 Dec 2005 08:32:55 +0100
> > 
> > Pete,
> > 
> > I see. No, in this case you're not missing anything although you may not
> > need to rewrite your whole code just to accomodate the new pattern.
> > Generating XML using SAX events is one way to generate XML, a good way
> > but not necessarily the only one. Remember that JAXP is quite flexible
> > and that you could use a DOMSource, for example, if you've already got
> > code that generates a DOM from your data. The purpose of the examples in
> > the examples/embedding directory are to show a gradual approach to the
> > patterns that we suggest people use. The benefit out of this is a
> > flexible and quick solution.
> > 
> > On 08.12.2005 08:20:49 Peter.Neu wrote:
> > > Hi Jeremias,
> > > 
> > > I was refering to Obj2PDF because this is the only example which shows
> > how
> > > to generate XML and then pass it to the FOP Transformation. XML2PDF
> > works
> > > with a static and already existing xml file. So the whole point was
> how
> > to
> > > pass a generated xml file to fop without writing it to the file
> system.
> > > Using the Obj2PDF requires a lot of refactoring in my code but that is
> > the
> > > only option I got I suppose, or am I missing something?
> > > 
> > > cheers,
> > > Pete 
> > > 
> > > > --- Ursprüngliche Nachricht ---
> > > > Von: Jeremias Maerki <[EMAIL PROTECTED]>
> > > > An: fop-users@xmlgraphics.apache.org
> > > > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > > > Datum: Wed, 07 Dec 2005 21:44:38 +0100
> > > > 
> > > > Yes, that's basically it, though ExampleObj2PDF is a bit special.
> > > > ExampleXML2PDF is the more generic example. And yes, it works in a
> > > > webapp.
> > > > 
> > > > On 07.12.2005 21:39:58 Peter.Neu wrote:
> > > > > Hi Glenn
> > > > > 
> > > > > did you mean this example? Taken from [1]. Does this work in a
> > webapp?
> > > > > 
> > > > > 
> > > > > //Setup output
> > > > > OutputStream out = new java.io.FileOutputStream(pdf);
> > > > >   try {
> > > > >   driver.setOutputStream(out);
> > > > >   //Setup XSLT
> > > > >   TransformerFactory factory =
> TransformerFactory.newInstance();
> > > > >   Transformer transformer = factory.newTransformer(new
>  
> >
> > > > > StreamSource(xslt));
> > > > >  //Setup input for XSLT transformation
> > > > >  Source src = team.getSourceForProjectTeam();
> > > > >     //Resulting SAX events (the generated FO) must be piped
> through
> > to
> > > > FOP
> > > > >  Result res = new SAXResult(driver.getContentHandler());
> > > > > 
> > > > >//Start XSLT transformation and FOP processing
> > > > > transformer.transform(src,
> > > > > res);
> > > > > 
> > > > >
> > > >
> > >
> >
>
[1]http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/tags/fop-0_20_5/examples/embedding/java/e

Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-07 Thread Peter . Neu
Hello Jeremias,

good your are in the cet time zone,too ;o). 
My code also uses sax so the refactoring process will not be that long.
Anyway it's always good to have a working example so I'll adapt to that. 
I'll be back with details when I'm done refactoring.

cheers,
Pete




> --- Ursprüngliche Nachricht ---
> Von: Jeremias Maerki <[EMAIL PROTECTED]>
> An: fop-users@xmlgraphics.apache.org
> Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> Datum: Thu, 08 Dec 2005 08:32:55 +0100
> 
> Pete,
> 
> I see. No, in this case you're not missing anything although you may not
> need to rewrite your whole code just to accomodate the new pattern.
> Generating XML using SAX events is one way to generate XML, a good way
> but not necessarily the only one. Remember that JAXP is quite flexible
> and that you could use a DOMSource, for example, if you've already got
> code that generates a DOM from your data. The purpose of the examples in
> the examples/embedding directory are to show a gradual approach to the
> patterns that we suggest people use. The benefit out of this is a
> flexible and quick solution.
> 
> On 08.12.2005 08:20:49 Peter.Neu wrote:
> > Hi Jeremias,
> > 
> > I was refering to Obj2PDF because this is the only example which shows
> how
> > to generate XML and then pass it to the FOP Transformation. XML2PDF
> works
> > with a static and already existing xml file. So the whole point was how
> to
> > pass a generated xml file to fop without writing it to the file system.
> > Using the Obj2PDF requires a lot of refactoring in my code but that is
> the
> > only option I got I suppose, or am I missing something?
> > 
> > cheers,
> > Pete 
> > 
> > > --- Ursprüngliche Nachricht ---
> > > Von: Jeremias Maerki <[EMAIL PROTECTED]>
> > > An: fop-users@xmlgraphics.apache.org
> > > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > > Datum: Wed, 07 Dec 2005 21:44:38 +0100
> > > 
> > > Yes, that's basically it, though ExampleObj2PDF is a bit special.
> > > ExampleXML2PDF is the more generic example. And yes, it works in a
> > > webapp.
> > > 
> > > On 07.12.2005 21:39:58 Peter.Neu wrote:
> > > > Hi Glenn
> > > > 
> > > > did you mean this example? Taken from [1]. Does this work in a
> webapp?
> > > > 
> > > > 
> > > > //Setup output
> > > > OutputStream out = new java.io.FileOutputStream(pdf);
> > > >   try {
> > > >   driver.setOutputStream(out);
> > > >   //Setup XSLT
> > > >   TransformerFactory factory = TransformerFactory.newInstance();
> > > >   Transformer transformer = factory.newTransformer(new  
>
> > > > StreamSource(xslt));
> > > >  //Setup input for XSLT transformation
> > > >  Source src = team.getSourceForProjectTeam();
> > > > //Resulting SAX events (the generated FO) must be piped through
> to
> > > FOP
> > > >  Result res = new SAXResult(driver.getContentHandler());
> > > > 
> > > >    //Start XSLT transformation and FOP processing
> > > > transformer.transform(src,
> > > > res);
> > > > 
> > > >
> > >
> >
>
[1]http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/tags/fop-0_20_5/examples/embedding/java/embedding/ExampleObj2PDF.java?view=markup
> > > > 
> > > > 
> > > > cheers,
> > > > Pete
> > > > 
> > > > 
> > > > 
> > > > > --- Ursprüngliche Nachricht ---
> > > > > Von: Glen Mazza <[EMAIL PROTECTED]>
> > > > > An: fop-users@xmlgraphics.apache.org
> > > > > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > > > > Datum: Wed, 07 Dec 2005 12:41:24 -0500
> > > > > 
> > > > > Don't use XSLTInputHandler.  Use JAXP[1] instead.
> > > > > 
> > > > > Glen
> > > > > 
> > > > > [1]
> http://xmlgraphics.apache.org/fop/0.20.5/embedding.html#examples
> > > > > 
> > > > > [EMAIL PROTECTED] wrote:
> > > > > 
> > > > > >Hello,
> > > > > >
> > > > > >I struggling to create a webapps that creates pdf's for xml
> > > documents.
> > > > > The
> > > > > >problem is: I can't pipe the output of my SAX transformation to
&

Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-07 Thread Jeremias Maerki
Pete,

I see. No, in this case you're not missing anything although you may not
need to rewrite your whole code just to accomodate the new pattern.
Generating XML using SAX events is one way to generate XML, a good way
but not necessarily the only one. Remember that JAXP is quite flexible
and that you could use a DOMSource, for example, if you've already got
code that generates a DOM from your data. The purpose of the examples in
the examples/embedding directory are to show a gradual approach to the
patterns that we suggest people use. The benefit out of this is a
flexible and quick solution.

On 08.12.2005 08:20:49 Peter.Neu wrote:
> Hi Jeremias,
> 
> I was refering to Obj2PDF because this is the only example which shows how
> to generate XML and then pass it to the FOP Transformation. XML2PDF works
> with a static and already existing xml file. So the whole point was how to
> pass a generated xml file to fop without writing it to the file system.
> Using the Obj2PDF requires a lot of refactoring in my code but that is the
> only option I got I suppose, or am I missing something?
> 
> cheers,
> Pete 
> 
> > --- Ursprüngliche Nachricht ---
> > Von: Jeremias Maerki <[EMAIL PROTECTED]>
> > An: fop-users@xmlgraphics.apache.org
> > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > Datum: Wed, 07 Dec 2005 21:44:38 +0100
> > 
> > Yes, that's basically it, though ExampleObj2PDF is a bit special.
> > ExampleXML2PDF is the more generic example. And yes, it works in a
> > webapp.
> > 
> > On 07.12.2005 21:39:58 Peter.Neu wrote:
> > > Hi Glenn
> > > 
> > > did you mean this example? Taken from [1]. Does this work in a webapp?
> > > 
> > > 
> > > //Setup output
> > > OutputStream out = new java.io.FileOutputStream(pdf);
> > >   try {
> > >   driver.setOutputStream(out);
> > >   //Setup XSLT
> > >   TransformerFactory factory = TransformerFactory.newInstance();
> > >   Transformer transformer = factory.newTransformer(new  
> > > StreamSource(xslt));
> > >  //Setup input for XSLT transformation
> > >  Source src = team.getSourceForProjectTeam();
> > > //Resulting SAX events (the generated FO) must be piped through to
> > FOP
> > >  Result res = new SAXResult(driver.getContentHandler());
> > > 
> > >//Start XSLT transformation and FOP processing
> > > transformer.transform(src,
> > > res);
> > > 
> > >
> >
> [1]http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/tags/fop-0_20_5/examples/embedding/java/embedding/ExampleObj2PDF.java?view=markup
> > > 
> > > 
> > > cheers,
> > > Pete
> > > 
> > > 
> > > 
> > > > --- Ursprüngliche Nachricht ---
> > > > Von: Glen Mazza <[EMAIL PROTECTED]>
> > > > An: fop-users@xmlgraphics.apache.org
> > > > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > > > Datum: Wed, 07 Dec 2005 12:41:24 -0500
> > > > 
> > > > Don't use XSLTInputHandler.  Use JAXP[1] instead.
> > > > 
> > > > Glen
> > > > 
> > > > [1] http://xmlgraphics.apache.org/fop/0.20.5/embedding.html#examples
> > > > 
> > > > [EMAIL PROTECTED] wrote:
> > > > 
> > > > >Hello,
> > > > >
> > > > >I struggling to create a webapps that creates pdf's for xml
> > documents.
> > > > The
> > > > >problem is: I can't pipe the output of my SAX transformation to the 
> > > > >XSLTInputHandler. 
> > > > >
> > > > >My code uses a static xsl document and dynamic xml documents. For
> > > > >demonstration purposes I create the xml file on the local filesystem
> > but
> > > > >that'S not very good for my webapplication :o/
> > > > >
> > > > >Here the code:
> > > > >
> > > > >File xmlfile = new
> > File(session.getServletContext().getRealPath("/xml/"),
> > > > >"nbw.xml");
> > > > >OutputStream out = new java.io.FileOutputStream(xmlfile);
> > > > >StreamResult streamResult = new StreamResult(out);
> > > > >SAXTransformerFactory tf = (SAXTransformerFactory)
> > > > >SAXTransformerFactory.newInstance();
> > > > >TransformerHandler hd = tf.newTransformerHandler();
> > > > >Transformer serializer = hd.getTransformer();
> > >

Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-07 Thread Peter . Neu
Hi Jeremias,

I was refering to Obj2PDF because this is the only example which shows how
to generate XML and then pass it to the FOP Transformation. XML2PDF works
with a static and already existing xml file. So the whole point was how to
pass a generated xml file to fop without writing it to the file system.
Using the Obj2PDF requires a lot of refactoring in my code but that is the
only option I got I suppose, or am I missing something?

cheers,
Pete 

> --- Ursprüngliche Nachricht ---
> Von: Jeremias Maerki <[EMAIL PROTECTED]>
> An: fop-users@xmlgraphics.apache.org
> Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> Datum: Wed, 07 Dec 2005 21:44:38 +0100
> 
> Yes, that's basically it, though ExampleObj2PDF is a bit special.
> ExampleXML2PDF is the more generic example. And yes, it works in a
> webapp.
> 
> On 07.12.2005 21:39:58 Peter.Neu wrote:
> > Hi Glenn
> > 
> > did you mean this example? Taken from [1]. Does this work in a webapp?
> > 
> > 
> > //Setup output
> > OutputStream out = new java.io.FileOutputStream(pdf);
> >   try {
> >   driver.setOutputStream(out);
> >   //Setup XSLT
> >   TransformerFactory factory = TransformerFactory.newInstance();
> >   Transformer transformer = factory.newTransformer(new  
> > StreamSource(xslt));
> >  //Setup input for XSLT transformation
> >  Source src = team.getSourceForProjectTeam();
> > //Resulting SAX events (the generated FO) must be piped through to
> FOP
> >  Result res = new SAXResult(driver.getContentHandler());
> > 
> >//Start XSLT transformation and FOP processing
> > transformer.transform(src,
> > res);
> > 
> >
>
[1]http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/tags/fop-0_20_5/examples/embedding/java/embedding/ExampleObj2PDF.java?view=markup
> > 
> > 
> > cheers,
> > Pete
> > 
> > 
> > 
> > > --- Ursprüngliche Nachricht ---
> > > Von: Glen Mazza <[EMAIL PROTECTED]>
> > > An: fop-users@xmlgraphics.apache.org
> > > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > > Datum: Wed, 07 Dec 2005 12:41:24 -0500
> > > 
> > > Don't use XSLTInputHandler.  Use JAXP[1] instead.
> > > 
> > > Glen
> > > 
> > > [1] http://xmlgraphics.apache.org/fop/0.20.5/embedding.html#examples
> > > 
> > > [EMAIL PROTECTED] wrote:
> > > 
> > > >Hello,
> > > >
> > > >I struggling to create a webapps that creates pdf's for xml
> documents.
> > > The
> > > >problem is: I can't pipe the output of my SAX transformation to the 
> > > >XSLTInputHandler. 
> > > >
> > > >My code uses a static xsl document and dynamic xml documents. For
> > > >demonstration purposes I create the xml file on the local filesystem
> but
> > > >that'S not very good for my webapplication :o/
> > > >
> > > >Here the code:
> > > >
> > > >File xmlfile = new
> File(session.getServletContext().getRealPath("/xml/"),
> > > >"nbw.xml");
> > > >OutputStream out = new java.io.FileOutputStream(xmlfile);
> > > >StreamResult streamResult = new StreamResult(out);
> > > >SAXTransformerFactory tf = (SAXTransformerFactory)
> > > >SAXTransformerFactory.newInstance();
> > > >TransformerHandler hd = tf.newTransformerHandler();
> > > >Transformer serializer = hd.getTransformer();
> > > >serializer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
> > > >serializer.setOutputProperty(OutputKeys.INDENT, "yes");
> > > >hd.setResult(streamResult);
> > > >
> > > >//Custom transformation with SAX
> > > >XmlTransformer xmlt = new XmlTransformer(hd);
> > > >String xslParam =
> > > session.getServletContext().getRealPath("/xml/nbw.xsl");
> > > >String xmlParam =
> > > session.getServletContext().getRealPath("/xml/nbw.xml");
> > > >
> > > >File xmlFile = new File(xmlParam);
> > > >
> > > >//XSLT Transformation
> > > >XSLTInputHandler input = 
> > > >new XSLTInputHandler(xmlFile, new File((xslParam)));
> > > >
> > > >renderXML(input, response);
> > > >
> > > >
> > > >
> > > >cheers,
> > > >Pete
> > > >
> 
> 
> Jeremias Maerki
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
GMX DSL-Flatrate 1 Jahr kostenlos* + WLAN-Router ab 0,- Euro*
Bis 31.12.2005 einsteigen! Infos unter: http://www.gmx.net/de/go/dsl

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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-07 Thread J.Pietschmann

[EMAIL PROTECTED] wrote:

did you mean this example?


Yes.


Does this work in a webapp?


Yes. You have to use a ByteArrayOutputStream as a buffer
to set the content length HTTP header correctly (there
are many code samples on the net for this detail).

Why do do think it might not work?


J.Pietschmann

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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-07 Thread Jeremias Maerki
Yes, that's basically it, though ExampleObj2PDF is a bit special.
ExampleXML2PDF is the more generic example. And yes, it works in a
webapp.

On 07.12.2005 21:39:58 Peter.Neu wrote:
> Hi Glenn
> 
> did you mean this example? Taken from [1]. Does this work in a webapp?
> 
> 
> //Setup output
> OutputStream out = new java.io.FileOutputStream(pdf);
>   try {
>   driver.setOutputStream(out);
>   //Setup XSLT
>   TransformerFactory factory = TransformerFactory.newInstance();
>   Transformer transformer = factory.newTransformer(new   
> StreamSource(xslt));
>  //Setup input for XSLT transformation
>  Source src = team.getSourceForProjectTeam();
> //Resulting SAX events (the generated FO) must be piped through to FOP
>  Result res = new SAXResult(driver.getContentHandler());
> 
>//Start XSLT transformation and FOP processing
> transformer.transform(src,
> res);
> 
> [1]http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/tags/fop-0_20_5/examples/embedding/java/embedding/ExampleObj2PDF.java?view=markup
> 
> 
> cheers,
> Pete
> 
> 
> 
> > --- Ursprüngliche Nachricht ---
> > Von: Glen Mazza <[EMAIL PROTECTED]>
> > An: fop-users@xmlgraphics.apache.org
> > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > Datum: Wed, 07 Dec 2005 12:41:24 -0500
> > 
> > Don't use XSLTInputHandler.  Use JAXP[1] instead.
> > 
> > Glen
> > 
> > [1] http://xmlgraphics.apache.org/fop/0.20.5/embedding.html#examples
> > 
> > [EMAIL PROTECTED] wrote:
> > 
> > >Hello,
> > >
> > >I struggling to create a webapps that creates pdf's for xml documents.
> > The
> > >problem is: I can't pipe the output of my SAX transformation to the 
> > >XSLTInputHandler. 
> > >
> > >My code uses a static xsl document and dynamic xml documents. For
> > >demonstration purposes I create the xml file on the local filesystem but
> > >that'S not very good for my webapplication :o/
> > >
> > >Here the code:
> > >
> > >File xmlfile = new File(session.getServletContext().getRealPath("/xml/"),
> > >"nbw.xml");
> > >OutputStream out = new java.io.FileOutputStream(xmlfile);
> > >StreamResult streamResult = new StreamResult(out);
> > >SAXTransformerFactory tf = (SAXTransformerFactory)
> > >SAXTransformerFactory.newInstance();
> > >TransformerHandler hd = tf.newTransformerHandler();
> > >Transformer serializer = hd.getTransformer();
> > >serializer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
> > >serializer.setOutputProperty(OutputKeys.INDENT, "yes");
> > >hd.setResult(streamResult);
> > >
> > >//Custom transformation with SAX
> > >XmlTransformer xmlt = new XmlTransformer(hd);
> > >String xslParam =
> > session.getServletContext().getRealPath("/xml/nbw.xsl");
> > >String xmlParam =
> > session.getServletContext().getRealPath("/xml/nbw.xml");
> > >
> > >File xmlFile = new File(xmlParam);
> > >
> > >//XSLT Transformation
> > >XSLTInputHandler input = 
> > >new XSLTInputHandler(xmlFile, new File((xslParam)));
> > >
> > >renderXML(input, response);
> > >
> > >
> > >
> > >cheers,
> > >Pete
> > >


Jeremias Maerki


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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-07 Thread Peter . Neu
Hi Glenn

did you mean this example? Taken from [1]. Does this work in a webapp?


//Setup output
OutputStream out = new java.io.FileOutputStream(pdf);
  try {
  driver.setOutputStream(out);
  //Setup XSLT
  TransformerFactory factory = TransformerFactory.newInstance();
  Transformer transformer = factory.newTransformer(new   
StreamSource(xslt));
 //Setup input for XSLT transformation
 Source src = team.getSourceForProjectTeam();
//Resulting SAX events (the generated FO) must be piped through to FOP
 Result res = new SAXResult(driver.getContentHandler());

   //Start XSLT transformation and FOP processing
transformer.transform(src,
res);

[1]http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/tags/fop-0_20_5/examples/embedding/java/embedding/ExampleObj2PDF.java?view=markup


cheers,
Pete



> --- Ursprüngliche Nachricht ---
> Von: Glen Mazza <[EMAIL PROTECTED]>
> An: fop-users@xmlgraphics.apache.org
> Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> Datum: Wed, 07 Dec 2005 12:41:24 -0500
> 
> Don't use XSLTInputHandler.  Use JAXP[1] instead.
> 
> Glen
> 
> [1] http://xmlgraphics.apache.org/fop/0.20.5/embedding.html#examples
> 
> [EMAIL PROTECTED] wrote:
> 
> >Hello,
> >
> >I struggling to create a webapps that creates pdf's for xml documents.
> The
> >problem is: I can't pipe the output of my SAX transformation to the 
> >XSLTInputHandler. 
> >
> >My code uses a static xsl document and dynamic xml documents. For
> >demonstration purposes I create the xml file on the local filesystem but
> >that'S not very good for my webapplication :o/
> >
> >Here the code:
> >
> >File xmlfile = new File(session.getServletContext().getRealPath("/xml/"),
> >"nbw.xml");
> >OutputStream out = new java.io.FileOutputStream(xmlfile);
> >StreamResult streamResult = new StreamResult(out);
> >SAXTransformerFactory tf = (SAXTransformerFactory)
> >SAXTransformerFactory.newInstance();
> >TransformerHandler hd = tf.newTransformerHandler();
> >Transformer serializer = hd.getTransformer();
> >serializer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
> >serializer.setOutputProperty(OutputKeys.INDENT, "yes");
> >hd.setResult(streamResult);
> >
> >//Custom transformation with SAX
> >XmlTransformer xmlt = new XmlTransformer(hd);
> >String xslParam =
> session.getServletContext().getRealPath("/xml/nbw.xsl");
> >String xmlParam =
> session.getServletContext().getRealPath("/xml/nbw.xml");
> >
> >File xmlFile = new File(xmlParam);
> >
> >//XSLT Transformation
> >XSLTInputHandler input = 
> >new XSLTInputHandler(xmlFile, new File((xslParam)));
> >
> >renderXML(input, response);
> >
> >
> >
> >cheers,
> >Pete
> >
> >  
> >
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
+++ GMX - die erste Adresse für Mail, Message, More +++

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



Re: How to pass input of xml tranfs. to xslt transf. ?

2005-12-07 Thread Glen Mazza

Don't use XSLTInputHandler.  Use JAXP[1] instead.

Glen

[1] http://xmlgraphics.apache.org/fop/0.20.5/embedding.html#examples

[EMAIL PROTECTED] wrote:


Hello,

I struggling to create a webapps that creates pdf's for xml documents. The
problem is: I can't pipe the output of my SAX transformation to the 
XSLTInputHandler. 


My code uses a static xsl document and dynamic xml documents. For
demonstration purposes I create the xml file on the local filesystem but
that'S not very good for my webapplication :o/

Here the code:

File xmlfile = new File(session.getServletContext().getRealPath("/xml/"),
"nbw.xml");
OutputStream out = new java.io.FileOutputStream(xmlfile);
StreamResult streamResult = new StreamResult(out);
SAXTransformerFactory tf = (SAXTransformerFactory)
SAXTransformerFactory.newInstance();
TransformerHandler hd = tf.newTransformerHandler();
Transformer serializer = hd.getTransformer();
serializer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
serializer.setOutputProperty(OutputKeys.INDENT, "yes");
hd.setResult(streamResult);

//Custom transformation with SAX
XmlTransformer xmlt = new XmlTransformer(hd);
String xslParam = session.getServletContext().getRealPath("/xml/nbw.xsl");
String xmlParam = session.getServletContext().getRealPath("/xml/nbw.xml");

File xmlFile = new File(xmlParam);

//XSLT Transformation
XSLTInputHandler input = 
new XSLTInputHandler(xmlFile, new File((xslParam)));


renderXML(input, response);



cheers,
Pete

 





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



How to pass input of xml tranfs. to xslt transf. ?

2005-12-07 Thread Peter . Neu
Hello,

I struggling to create a webapps that creates pdf's for xml documents. The
problem is: I can't pipe the output of my SAX transformation to the 
XSLTInputHandler. 

My code uses a static xsl document and dynamic xml documents. For
demonstration purposes I create the xml file on the local filesystem but
that'S not very good for my webapplication :o/

Here the code:

File xmlfile = new File(session.getServletContext().getRealPath("/xml/"),
"nbw.xml");
OutputStream out = new java.io.FileOutputStream(xmlfile);
StreamResult streamResult = new StreamResult(out);
SAXTransformerFactory tf = (SAXTransformerFactory)
SAXTransformerFactory.newInstance();
TransformerHandler hd = tf.newTransformerHandler();
Transformer serializer = hd.getTransformer();
serializer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
serializer.setOutputProperty(OutputKeys.INDENT, "yes");
hd.setResult(streamResult);

//Custom transformation with SAX
XmlTransformer xmlt = new XmlTransformer(hd);
String xslParam = session.getServletContext().getRealPath("/xml/nbw.xsl");
String xmlParam = session.getServletContext().getRealPath("/xml/nbw.xml");

File xmlFile = new File(xmlParam);

//XSLT Transformation
XSLTInputHandler input = 
new XSLTInputHandler(xmlFile, new File((xslParam)));

renderXML(input, response);



cheers,
Pete

-- 
Telefonieren Sie schon oder sparen Sie noch?
NEU: GMX Phone_Flat http://www.gmx.net/de/go/telefonie

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