You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Clifton Craig <cc...@icsaward.com> on 2006/06/20 16:27:45 UTC

I need help with an XSL-FO solution

Hello all,

I've started a project involving rather complicated FOP generation. I have the 
details on what exactly I'm trying to do on my weblog here: 
http://codeforfun.wordpress.com/2006/06/12/new-xml-grammar/

In short, I'm writing a stylesheet that transforms a custom XML grammar into 
XSL-FO stylesheets. These generated XSL-FO stylesheets (XSLT templates that 
generate raw FO using input XML) will be used to process an input XML and 
generate PDFs. My current problem regards unit testing pieces of my solution. 
I currently need a way to validate first the XSL-FO that I generate and 
secondly validate the FO that the generated XSL-FO creates. I'm doing a lot 
of manual work right now to acheive this. What I do is load a sample of my 
custom XML grammar (I call it SSML) into a TrAX transform with my 
SSMLStylesheet. (That's what generates the XSL-FO.) I diff it against a 
golden copy of what I believe the output XSL-FO should look like. I've also 
been separately testing the golden copy to make sure it actually works and 
generates a PDF when run against FOP. 

I desparately need a way to streamline the entire process. I want to enahnce 
the golden copy and have an automated test verify that the changes I make 
still generate valid FO syntax. I also want to verify the output of my 
SSMLStylesheet is valid XSLT before diff'ing it against my golden copy. I'm 
also having a little trouble with XMLUnit doing diffs. I've gotten spoiled 
with Idea's auto-diff on failed String assertions in junit tests, so when I 
see the messages generated by XMLUnit it takes a moment to decipher what's 
actually wrong. What I've been doing is trapping the XMLDiff 
AssertionFailedException and doing an assertEquals on the two XML strings so 
I can take advantage of Idea's diff. It's clumsy but I can pick out the error 
a little better this way. The other problem is the generated stylesheets are 
not formatted (indented and such) so even with Idea's string diff I have to 
squint, turn my head sideways and figure it out. What I do then is copy the 
generated stylesheet and paste it in a temp file and format it. That moves 
completely away from unit testing and is more of an eyeball test. So as you 
can see I am really struggling with the testing. I'll stop rambling now. Are 
there any XSL gurus out there that can offer some insight?

--------------------------------------------------- 
Clifton C. Craig, Software Engineer
Tell me what's up...
visit: http://codeforfun.wordpress.com
ccc@icsaward.com

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


Re: I need help with an XSL-FO solution

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Clifton Craig wrote:
> My other major question is are there any FO validators available in 
> the FO package?

See
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/foschema/fop.xsd?revision=198361
for a schema which can be used for validation. Because of
restrictions of what can be expressed by an XSD, some constraints
can't be expressed. The schema also tries to validate
FO property values in a somewhat simplistic way, resulting in
the rejection of valid FO documents. It seems to omit FO 1.1
elements as well as FOP extensions as well as possible
content for fo:instream-foreign-object.

> What do others use (if anything) to validate their FO?
FOP will validate the input quite thoroughly unless validation
is relaxed.

J.Pietschmann

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


Re: I need help with an XSL-FO solution

Posted by Chris Bowditch <bo...@hotmail.com>.
Clifton Craig wrote:
> Johannes,
> 
> Thanx for the feedback. I realize my question speaks more towards the 
> development practices regarding XSL-FO but I was hoping to run across some 
> experts in the field that might shed some light on my situation. I'll try 
> another list and see if I have better luck. Indentation can be done by the 
> Xalan processor it's just that the way I'm using it seems to not work. I know 
> there are options you can use in your stylesheet but they don't seem to be 
> working with the way I'm doing my transform. Are there any Xalan experts out 

setting indentation options in the stylesheet itself, i.e. <output 
indent="yes"/> only seems to work when running from the command line. If 
you are serializing the output within a program then you need to set 
indentation on the serializer properties.

I don't have a clue about any of your other questions. Sorry,

Chris



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


Re: I need help with an XSL-FO solution

Posted by Clifton Craig <cc...@icsaward.com>.
Johannes,

Thanx for the feedback. I realize my question speaks more towards the 
development practices regarding XSL-FO but I was hoping to run across some 
experts in the field that might shed some light on my situation. I'll try 
another list and see if I have better luck. Indentation can be done by the 
Xalan processor it's just that the way I'm using it seems to not work. I know 
there are options you can use in your stylesheet but they don't seem to be 
working with the way I'm doing my transform. Are there any Xalan experts out 
there? My other major question is are there any FO validators available in 
the FO package? What do others use (if anything) to validate their FO?

---------------------------------------------------
Clifton C. Craig, Software Engineer
Tell me what's up...
visit: http://codeforfun.wordpress.com
ccc@icsaward.com

On Tuesday 20 June 2006 4:48 pm, Johannes Künsebeck wrote:
> Hi,
> thats only a 10% fop-question, so maybe you can find better lists these
> problems.
> To indent your style-sheets, you can use tidy :
> http://tidy.sourceforge.net/ bye, Johannes
>
> Clifton Craig schrieb:
> > Hello all,
> >
> > I've started a project involving rather complicated FOP generation. I
> > have the details on what exactly I'm trying to do on my weblog here:
> > http://codeforfun.wordpress.com/2006/06/12/new-xml-grammar/
> >
> > In short, I'm writing a stylesheet that transforms a custom XML grammar
> > into XSL-FO stylesheets. These generated XSL-FO stylesheets (XSLT
> > templates that generate raw FO using input XML) will be used to process
> > an input XML and generate PDFs. My current problem regards unit testing
> > pieces of my solution. I currently need a way to validate first the
> > XSL-FO that I generate and secondly validate the FO that the generated
> > XSL-FO creates. I'm doing a lot of manual work right now to acheive this.
> > What I do is load a sample of my custom XML grammar (I call it SSML) into
> > a TrAX transform with my SSMLStylesheet. (That's what generates the
> > XSL-FO.) I diff it against a golden copy of what I believe the output
> > XSL-FO should look like. I've also been separately testing the golden
> > copy to make sure it actually works and generates a PDF when run against
> > FOP.
> >
> > I desparately need a way to streamline the entire process. I want to
> > enahnce the golden copy and have an automated test verify that the
> > changes I make still generate valid FO syntax. I also want to verify the
> > output of my SSMLStylesheet is valid XSLT before diff'ing it against my
> > golden copy. I'm also having a little trouble with XMLUnit doing diffs.
> > I've gotten spoiled with Idea's auto-diff on failed String assertions in
> > junit tests, so when I see the messages generated by XMLUnit it takes a
> > moment to decipher what's actually wrong. What I've been doing is
> > trapping the XMLDiff
> > AssertionFailedException and doing an assertEquals on the two XML strings
> > so I can take advantage of Idea's diff. It's clumsy but I can pick out
> > the error a little better this way. The other problem is the generated
> > stylesheets are not formatted (indented and such) so even with Idea's
> > string diff I have to squint, turn my head sideways and figure it out.
> > What I do then is copy the generated stylesheet and paste it in a temp
> > file and format it. That moves completely away from unit testing and is
> > more of an eyeball test. So as you can see I am really struggling with
> > the testing. I'll stop rambling now. Are there any XSL gurus out there
> > that can offer some insight?
> >
> > ---------------------------------------------------
> > Clifton C. Craig, Software Engineer
> > Tell me what's up...
> > visit: http://codeforfun.wordpress.com
> > ccc@icsaward.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org

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


Re: I need help with an XSL-FO solution

Posted by Johannes Künsebeck <ku...@gmx.net>.
Hi,
thats only a 10% fop-question, so maybe you can find better lists these
problems.
To indent your style-sheets, you can use tidy : http://tidy.sourceforge.net/
bye, Johannes


Clifton Craig schrieb:
> Hello all,
>
> I've started a project involving rather complicated FOP generation. I have the 
> details on what exactly I'm trying to do on my weblog here: 
> http://codeforfun.wordpress.com/2006/06/12/new-xml-grammar/
>
> In short, I'm writing a stylesheet that transforms a custom XML grammar into 
> XSL-FO stylesheets. These generated XSL-FO stylesheets (XSLT templates that 
> generate raw FO using input XML) will be used to process an input XML and 
> generate PDFs. My current problem regards unit testing pieces of my solution. 
> I currently need a way to validate first the XSL-FO that I generate and 
> secondly validate the FO that the generated XSL-FO creates. I'm doing a lot 
> of manual work right now to acheive this. What I do is load a sample of my 
> custom XML grammar (I call it SSML) into a TrAX transform with my 
> SSMLStylesheet. (That's what generates the XSL-FO.) I diff it against a 
> golden copy of what I believe the output XSL-FO should look like. I've also 
> been separately testing the golden copy to make sure it actually works and 
> generates a PDF when run against FOP. 
>
> I desparately need a way to streamline the entire process. I want to enahnce 
> the golden copy and have an automated test verify that the changes I make 
> still generate valid FO syntax. I also want to verify the output of my 
> SSMLStylesheet is valid XSLT before diff'ing it against my golden copy. I'm 
> also having a little trouble with XMLUnit doing diffs. I've gotten spoiled 
> with Idea's auto-diff on failed String assertions in junit tests, so when I 
> see the messages generated by XMLUnit it takes a moment to decipher what's 
> actually wrong. What I've been doing is trapping the XMLDiff 
> AssertionFailedException and doing an assertEquals on the two XML strings so 
> I can take advantage of Idea's diff. It's clumsy but I can pick out the error 
> a little better this way. The other problem is the generated stylesheets are 
> not formatted (indented and such) so even with Idea's string diff I have to 
> squint, turn my head sideways and figure it out. What I do then is copy the 
> generated stylesheet and paste it in a temp file and format it. That moves 
> completely away from unit testing and is more of an eyeball test. So as you 
> can see I am really struggling with the testing. I'll stop rambling now. Are 
> there any XSL gurus out there that can offer some insight?
>
> --------------------------------------------------- 
> Clifton C. Craig, Software Engineer
> Tell me what's up...
> visit: http://codeforfun.wordpress.com
> ccc@icsaward.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>
>   

-- 
Johannes Künsebeck
Heeper Str. 52
33607 Bielefeld

0521 / 5202341
kuensebeck@gmx.net


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


Re: I need help with an XSL-FO solution

Posted by Clifton Craig <cc...@icsaward.com>.
J.,

Thank you for your suggestions. I'll check out the mulberrytech list as well 
as the dex.com lists. I am using XMLUnit for testing but I'm having a little 
difficulty with it as I detail on my site. As far as the nomenclature, I get 
equally as confused with it. I guess the proper term for the stylesheets I 
generate is just XSLT. They really are no different from other XSLT 
stylesheets. Maybe there is no such thing as raw FO and maybe I'll start 
referring to that as merely FO. Thanx anyhow for the advice.

------------------------------------------------- 
Clifton C. Craig, Software Engineer
Tell me what's up...
visit: http://codeforfun.wordpress.com
ccc@icsaward.com

On Tuesday 20 June 2006 5:58 pm, J.Pietschmann wrote:
> Clifton Craig wrote:
> > Are
> > there any XSL gurus out there that can offer some insight?
>
> You'll probably want to post this on the XSL list
>   http://www.mulberrytech.com/xsl/xsl-list
> although unit testing style sheet generators is somewhat
> far out even there.
>
> Note that your nomenclature is slightly non-standard
> and might hinder understanding your problem, I recommend
> lurking on the list for a day or two, then adjust the
> wording.
>
> Also check whether XMLUnit
>   http://xmlunit.sourceforge.net/
> can help you.
>
> J.Pietschmann
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org

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


Re: I need help with an XSL-FO solution

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Clifton Craig wrote:
> Are 
> there any XSL gurus out there that can offer some insight?

You'll probably want to post this on the XSL list
  http://www.mulberrytech.com/xsl/xsl-list
although unit testing style sheet generators is somewhat
far out even there.

Note that your nomenclature is slightly non-standard
and might hinder understanding your problem, I recommend
lurking on the list for a day or two, then adjust the
wording.

Also check whether XMLUnit
  http://xmlunit.sourceforge.net/
can help you.

J.Pietschmann

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