Re: XML parsing
Alastair Growcott wrote: Any chance that FOP will ever use the stylesheet specified in the XML file to peform the XSLT? You can implement it yourself. Rip some code from Xalan or Cocoon which extracts the stylesheet PI from the XML and the logic to invoke the transformation, and pipe the result to a FOP driver. Hava fun! J.Pietschmann
RE: XML parsing
Let me see, part of this problem is XSL(T), part of the problem is how to pass the result to Acrobat, right? At the moment I'm pretty busy solving a little problem over here but I'll get back with a style sheet bit to extract the stylesheetname from the XML file (that should be possible, or am I completely insane? Should be similar to parsing processing instructions, not?). The parameter thing is pretty simple and works basically like passing paramters to templates (use the -param switch for Xalan). This might require a change in fop though, as I don't think passing a parameter is available via fop. Later, Michiel $ -Original Message- $ From: Alastair Growcott [mailto:[EMAIL PROTECTED] $ Sent: dinsdag 26 maart 2002 14:55 $ To: [EMAIL PROTECTED] $ Subject: RE: XML parsing $ $ $ > on at the moment and one can create new calls to programs to $ > open a file (tools, folder options, file types tab). Suppose $ > you simply define an option to "view as PDF" or something? $ > You can specify a call to fop (with a call to the style sheet $ > that will filter out what exactly to do with the style sheet $ > called in the XML document) there and see what happens. $ $ $ That is basically what I am doing at the moment, but there are two $ problems. Firstly the script to view as PDF needs to know the exact $ stylesheet to use. When opening XML in IE, IE reads the stylesheet to $ use from the XML file, so the whole thing is simplified. If FOP could $ read the stylesheet to use in the same way, then the whole thing would $ be simple. At the moment, to read my XML defined in my CCR DTD, I use $ ccr_fo.xsl, and I have to run a specific script to specify that $ stylesheet. To run that specific script I need to use a different file $ extension. Hence for each DTD you need a different file $ extension, which $ basically is the opposite of the purposes of XML being a meta data $ language. $ $ The second problem is that when using a different extension with an $ "View as PDF", I cannot find a way to have FOP pass the data $ directly to $ PDF. This means that my script consists of two steps - Use FOP to $ compile to PDF, and then run Acrobat Reader to view the $ interim file. At $ the end of the process the interim file is still lurking around. Plus $ running a script opens a DOS prompt window that looks $ unnecessary. Since $ IE can use Acrobat Reader as a plug-in, it would be nice if we could $ display in IE as a PDF file without having any other windows $ mysteriously (to a user) appearing. $ $ I like your idea to have one stylesheet that converts to either PDF or $ HTML. Could you give me some simple code that detects a parameter and $ either does one thing or another. One day IE will no doubt display XSL $ FO, and it won't be needed :) $ $ Lastly, I see that Acrobat Reader can run plug-ins. It would $ be nice to $ open the XML file directly to Acrobat Reader, which detects that it is $ an XML file (AR already has some XML functionality relating to forms, $ but I have no idea what, how, when, or where), and pre-processes it $ using FOP and the relevant style sheet. Anyone have any idea how to $ write Acrobat Reader plug-ins? $ $
RE: XML parsing
> on at the moment and one can create new calls to programs to > open a file (tools, folder options, file types tab). Suppose > you simply define an option to "view as PDF" or something? > You can specify a call to fop (with a call to the style sheet > that will filter out what exactly to do with the style sheet > called in the XML document) there and see what happens. That is basically what I am doing at the moment, but there are two problems. Firstly the script to view as PDF needs to know the exact stylesheet to use. When opening XML in IE, IE reads the stylesheet to use from the XML file, so the whole thing is simplified. If FOP could read the stylesheet to use in the same way, then the whole thing would be simple. At the moment, to read my XML defined in my CCR DTD, I use ccr_fo.xsl, and I have to run a specific script to specify that stylesheet. To run that specific script I need to use a different file extension. Hence for each DTD you need a different file extension, which basically is the opposite of the purposes of XML being a meta data language. The second problem is that when using a different extension with an "View as PDF", I cannot find a way to have FOP pass the data directly to PDF. This means that my script consists of two steps - Use FOP to compile to PDF, and then run Acrobat Reader to view the interim file. At the end of the process the interim file is still lurking around. Plus running a script opens a DOS prompt window that looks unnecessary. Since IE can use Acrobat Reader as a plug-in, it would be nice if we could display in IE as a PDF file without having any other windows mysteriously (to a user) appearing. I like your idea to have one stylesheet that converts to either PDF or HTML. Could you give me some simple code that detects a parameter and either does one thing or another. One day IE will no doubt display XSL FO, and it won't be needed :) Lastly, I see that Acrobat Reader can run plug-ins. It would be nice to open the XML file directly to Acrobat Reader, which detects that it is an XML file (AR already has some XML functionality relating to forms, but I have no idea what, how, when, or where), and pre-processes it using FOP and the relevant style sheet. Anyone have any idea how to write Acrobat Reader plug-ins?
RE: XML parsing
Hi, Please don't get too upset as I clearly misinterpreted your question. I'm not that experienced with Windows but it might be possible to pass a parameter to a stylesheet when the document is view with a right mouse click (defining for instance the format, HTML or fo) . Depending on this setting the XSLT style sheet will select either to produce HTML or a fo file. If you use a specific right-mouse-click/open with option you might be able to call fop this way. I just had a look at the windows explorer on this win2k machine I am working on at the moment and one can create new calls to programs to open a file (tools, folder options, file types tab). Suppose you simply define an option to "view as PDF" or something? You can specify a call to fop (with a call to the style sheet that will filter out what exactly to do with the style sheet called in the XML document) there and see what happens. Just a thought, not sure if this is going to work though. If I am being vague and unclear, please say so, I'm better with code than English ;-) Cheers, Michiel $ -Original Message- $ From: Alastair Growcott [mailto:[EMAIL PROTECTED] $ Sent: dinsdag 26 maart 2002 14:01 $ To: [EMAIL PROTECTED] $ Subject: RE: XML parsing $ $ $ What I am currently looking at is to specify the HTML $ stylesheet in the $ header so that it can be quick-viewed simply by users (with $ typical user $ know-how - ie none) double-clicking the icon in explorer. I am then $ defining a custom file type and changing the XML file extension such $ that a script is run which in turn runs FOP. This thus gives $ me two view $ output possibilities. $ $ What I would like is to use the stylesheet specification that $ currently $ transforms to HTML to specify some sort of (java)script file that will $ run FOP. $ $ I never, ever said I wanted to use the HTML transform stylesheet with $ FOP. I am not that stupid. However if FOP parsed the line $ that specified $ a stylesheet, and automatically pulled it in, so that the -xsl command $ line option was not needed, that would simplify the processing of XML $ files to PDF using FOP! And OF COURSE the stylesheet $ specified for this $ usage would be an FO transform stylesheet!" $ $ $ > -Original Message- $ > From: Michiel Verhoef [mailto:[EMAIL PROTECTED] $ > Sent: 26 March 2002 12:50 $ > To: '[EMAIL PROTECTED]' $ > Subject: RE: XML parsing $ > $ > $ > Hi, $ > $ > HTML does not nearly have the kind of formatting necessary $ > for proper formatting $ > for paper that to me the use of such a style sheet (a $ > tranfsormation to $ > HTML) $ > sounds not very useful. Most HTML formatting does not match $ > the formatting tags used in fo (for example tables) so the $ > result of the transformation (such as an HTML table or $ > headings) will not be recognised bij fop. $ > $ > If you would like to include standard style properties or $ > even templates that you want to share from one source you can $ > include such a file in your XSL file that you use for a $ > translation to fo. $ > $ > A css kind-of style that can be used for both a tranformation $ > to HTML and to fo would be nice though. $ > $ > Regards, $ > $ > $ > Michiel $ > $ > $ > $ -Original Message----- $ > $ From: Alastair Growcott [mailto:[EMAIL PROTECTED] $ > $ Sent: dinsdag 26 maart 2002 13:38 $ > $ To: [EMAIL PROTECTED] $ > $ Subject: RE: XML parsing $ > $ $ > $ $ > $ My XML file looks like: $ > $ $ > $ $ > $ href="file:///D:/XML/ccr.xsl"?> $ ... $ $ > $ $ > $ This means that when I double click it, IE6 automatically $ > displays it $ correctly because ccr.xls converts the XML $ > contents to HTML/CSS. Very $ nice and useful. $ $ > $ $ > $ $ > $ > -Original Message- $ > $ > From: Michiel Verhoef [mailto:[EMAIL PROTECTED] $ > $ > Sent: 26 March 2002 12:14 $ > $ > To: '[EMAIL PROTECTED]' $ > $ > Subject: RE: XML parsing $ > $ > $ > $ > $ > $ > Does this imply that all your XML files have a style $ > sheet included? $ > $ > Because AFAIK this is not $ > mandatory/common practice so to $ > speak of _the_ stylesheet $ > included in the XML file is $ > probably not enough to $ > explain what exactly you are referring to. $ > $ > Do you $ > mean if an XML file has an internal style (probably $ > XSL, $ > or CSS?) this style sheet will be processed? That would $ > $ > be an interesting question.. $ > $ > Michiel $ > $ > $ $ > -Original Message- $ > $ From: Alastair Growcott $ > [mailto:[EMAIL PROTECTED] $ > $ > $ Sent: dinsdag $ > 26 maart 2002 13:12 $ > $ > $ To: [EMAIL PROTECTED] $ > $ > $ Subject: XML parsing $ > $ > $ $ > $ > $ $ > $ > $ Any chance that FOP will ever use the stylesheet $ > specified $ > in the XML $ file to peform the XSLT? $ $ > $ $ $ > > $ $ > $ $ > $ $ > $ $
RE: XML parsing
What I am currently looking at is to specify the HTML stylesheet in the header so that it can be quick-viewed simply by users (with typical user know-how - ie none) double-clicking the icon in explorer. I am then defining a custom file type and changing the XML file extension such that a script is run which in turn runs FOP. This thus gives me two view output possibilities. What I would like is to use the stylesheet specification that currently transforms to HTML to specify some sort of (java)script file that will run FOP. I never, ever said I wanted to use the HTML transform stylesheet with FOP. I am not that stupid. However if FOP parsed the line that specified a stylesheet, and automatically pulled it in, so that the -xsl command line option was not needed, that would simplify the processing of XML files to PDF using FOP! And OF COURSE the stylesheet specified for this usage would be an FO transform stylesheet!" > -Original Message- > From: Michiel Verhoef [mailto:[EMAIL PROTECTED] > Sent: 26 March 2002 12:50 > To: '[EMAIL PROTECTED]' > Subject: RE: XML parsing > > > Hi, > > HTML does not nearly have the kind of formatting necessary > for proper formatting > for paper that to me the use of such a style sheet (a > tranfsormation to > HTML) > sounds not very useful. Most HTML formatting does not match > the formatting tags used in fo (for example tables) so the > result of the transformation (such as an HTML table or > headings) will not be recognised bij fop. > > If you would like to include standard style properties or > even templates that you want to share from one source you can > include such a file in your XSL file that you use for a > translation to fo. > > A css kind-of style that can be used for both a tranformation > to HTML and to fo would be nice though. > > Regards, > > > Michiel > > > $ -Original Message- > $ From: Alastair Growcott [mailto:[EMAIL PROTECTED] > $ Sent: dinsdag 26 maart 2002 13:38 > $ To: [EMAIL PROTECTED] > $ Subject: RE: XML parsing > $ > $ > $ My XML file looks like: > $ > $ > $ href="file:///D:/XML/ccr.xsl"?> $ ... $ > $ > $ This means that when I double click it, IE6 automatically > displays it $ correctly because ccr.xls converts the XML > contents to HTML/CSS. Very $ nice and useful. $ > $ > $ > $ > -Original Message- > $ > From: Michiel Verhoef [mailto:[EMAIL PROTECTED] > $ > Sent: 26 March 2002 12:14 > $ > To: '[EMAIL PROTECTED]' > $ > Subject: RE: XML parsing > $ > > $ > > $ > Does this imply that all your XML files have a style > sheet included? $ > $ > Because AFAIK this is not > mandatory/common practice so to $ > speak of _the_ stylesheet > included in the XML file is $ > probably not enough to > explain what exactly you are referring to. $ > $ > Do you > mean if an XML file has an internal style (probably $ > XSL, > or CSS?) this style sheet will be processed? That would $ > > be an interesting question.. $ > $ > Michiel $ > $ > $ > -Original Message- $ > $ From: Alastair Growcott > [mailto:[EMAIL PROTECTED] > $ > $ Sent: dinsdag > 26 maart 2002 13:12 > $ > $ To: [EMAIL PROTECTED] > $ > $ Subject: XML parsing > $ > $ > $ > $ > $ > $ Any chance that FOP will ever use the stylesheet > specified $ > in the XML $ file to peform the XSLT? $ $ > $ $ > > $ $ > $ > $ >
RE: XML parsing
Hi, HTML does not nearly have the kind of formatting necessary for proper formatting for paper that to me the use of such a style sheet (a tranfsormation to HTML) sounds not very useful. Most HTML formatting does not match the formatting tags used in fo (for example tables) so the result of the transformation (such as an HTML table or headings) will not be recognised bij fop. If you would like to include standard style properties or even templates that you want to share from one source you can include such a file in your XSL file that you use for a translation to fo. A css kind-of style that can be used for both a tranformation to HTML and to fo would be nice though. Regards, Michiel $ -Original Message- $ From: Alastair Growcott [mailto:[EMAIL PROTECTED] $ Sent: dinsdag 26 maart 2002 13:38 $ To: [EMAIL PROTECTED] $ Subject: RE: XML parsing $ $ $ My XML file looks like: $ $ $ $ ... $ $ $ This means that when I double click it, IE6 automatically displays it $ correctly because ccr.xls converts the XML contents to HTML/CSS. Very $ nice and useful. $ $ $ $ > -Original Message- $ > From: Michiel Verhoef [mailto:[EMAIL PROTECTED] $ > Sent: 26 March 2002 12:14 $ > To: '[EMAIL PROTECTED]' $ > Subject: RE: XML parsing $ > $ > $ > Does this imply that all your XML files have a style sheet included? $ > $ > Because AFAIK this is not mandatory/common practice so to $ > speak of _the_ stylesheet included in the XML file is $ > probably not enough to explain what exactly you are referring to. $ > $ > Do you mean if an XML file has an internal style (probably $ > XSL, or CSS?) this style sheet will be processed? That would $ > be an interesting question.. $ > $ > Michiel $ > $ > $ -Original Message- $ > $ From: Alastair Growcott [mailto:[EMAIL PROTECTED] $ > $ Sent: dinsdag 26 maart 2002 13:12 $ > $ To: [EMAIL PROTECTED] $ > $ Subject: XML parsing $ > $ $ > $ $ > $ Any chance that FOP will ever use the stylesheet specified $ > in the XML $ file to peform the XSLT? $ $ > $ $ > $ $ > $ $
RE: XML parsing
My XML file looks like: ... This means that when I double click it, IE6 automatically displays it correctly because ccr.xls converts the XML contents to HTML/CSS. Very nice and useful. > -Original Message- > From: Michiel Verhoef [mailto:[EMAIL PROTECTED] > Sent: 26 March 2002 12:14 > To: '[EMAIL PROTECTED]' > Subject: RE: XML parsing > > > Does this imply that all your XML files have a style sheet included? > > Because AFAIK this is not mandatory/common practice so to > speak of _the_ stylesheet included in the XML file is > probably not enough to explain what exactly you are referring to. > > Do you mean if an XML file has an internal style (probably > XSL, or CSS?) this style sheet will be processed? That would > be an interesting question.. > > Michiel > > $ -Original Message- > $ From: Alastair Growcott [mailto:[EMAIL PROTECTED] > $ Sent: dinsdag 26 maart 2002 13:12 > $ To: [EMAIL PROTECTED] > $ Subject: XML parsing > $ > $ > $ Any chance that FOP will ever use the stylesheet specified > in the XML $ file to peform the XSLT? $ > $ > $ >
RE: XML parsing
Does this imply that all your XML files have a style sheet included? Because AFAIK this is not mandatory/common practice so to speak of _the_ stylesheet included in the XML file is probably not enough to explain what exactly you are referring to. Do you mean if an XML file has an internal style (probably XSL, or CSS?) this style sheet will be processed? That would be an interesting question.. Michiel $ -Original Message- $ From: Alastair Growcott [mailto:[EMAIL PROTECTED] $ Sent: dinsdag 26 maart 2002 13:12 $ To: [EMAIL PROTECTED] $ Subject: XML parsing $ $ $ Any chance that FOP will ever use the stylesheet specified in the XML $ file to peform the XSLT? $ $ $