Skip to content
Advertisement

XML to postscript using xsltproc

I’m trying to produce a postscript file for an XML document. I can produce a plain text or an html output using xsltproc.

xsltproc --output output.txt xslFile.xsl input.xml

Is there a way to produce a postscript file from command line or programmatically using C?

Advertisement

Answer

One possibility to achieve this is converting the XML-file to XSL-FO and then use Apache-FOP to transform it to a Postscript-file with

fop -xml input.xml -xsl xml2fo.xsl -ps output.ps

At the moment I couldn’t find a simple XSL-file on the net for this task, but this depends on what you like the output to look anyway. Creating a basic XSLT for this transformation should not be that hard.

EDIT: Just for completeness: possible output-formats of Apache-FOP are

-pdf outfile      input will be rendered as PDF (outfile req'd)
-pdfa1b outfile   input will be rendered as PDF/A-1b compliant PDF
                    (outfile req'd, same as "-pdf outfile -pdfprofile PDF/A-1b")
-awt              input will be displayed on screen 
-rtf outfile      input will be rendered as RTF (outfile req'd)
-pcl outfile      input will be rendered as PCL (outfile req'd) 
-ps outfile       input will be rendered as PostScript (outfile req'd) 
-afp outfile      input will be rendered as AFP (outfile req'd)
-tiff outfile     input will be rendered as TIFF (outfile req'd)
-png outfile      input will be rendered as PNG (outfile req'd)
-txt outfile      input will be rendered as plain text (outfile req'd) 
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement