Is there a good tool for XSL previews? - html

I'm a LAMP web developer in Perl and at my current place we use some black magic in using Perl to retrieve the data, throw them into a XML and then pass the XML to an XSL file. And this is all handled magically by the almighty AxKit. Thus you can probably imagine that my XSL is full of XSLT lines, i.e. if test,#value etc.
I was wondering if there's any tool, IDE, etc which I can use to open the XSL file and check the HTML preview without having to modify anything in my current XSL?
I'm open for suggestions as long as it gets the job done. Thanks.

XSLT IDEs (Interactive Development Environments):
XSelerator (the one I've been using for 6-7 years). Free, has a Debugger for MSXML, has intellisense for both XSLT 1.0 and XSLT 2.0. In addition has some dynamic intellisense. The debugger has breakpoints, data breakpoints,visualizes temporary trees, variables, test conditions, current output, ..., etc.
VS2008 -- a good XML Editor + XSLT Debugger. Good static intellisence. Match patterns are statically checked. Breakpoints, data breakpoints, visualization of variables and the current output.
oXygen
XML-SPY (Altova)
Stylus Studio
XPath tools:
Update:
Both the IE and the FF versions of the XPath Visualizer have now a new, safe home, thanks to the hospitality of Lars Huttar. The links below point to the new, safe site.
The XPath Visualizer -- A popular IE-based tool for learning XPath and FF-based, too, by playing with XPath expressions. Free and open source. Allows any XPath expression to be evaluated against a given XML document and displayes the results hi-lighted in the xml document (if they are node(s)) or in a separate box (if the results are atomic values). Allows xsl:variable-s to be defined and then used in XPath expressions. Allows xsl:key-s to be defined and then referenced by key() functions within XPath expressions.

I am currently using Visual Studio, open your xml file within visual studio, from XML menu click show xslt output.

I found Stylus Studio to be an invaluable tool for all my XML needs. I never ran it rough Wine though.

I use cooktop which is free.

Try Microsoft XML Notepad

I'm using Visual Web Developer 2008 Express Edition...under my XML menu all I see is "Schemas..." when I have an XSL file open. Did I miss installing a component for the other options?

A couple of alternatives that haven't been mentioned, yet:
XML Copy Editor - Okay, but requires an intermediate step to generate HTML and then open HTML in an external browser.
WMHelp XMLPad - Many minor bugs and annoyances, but otherwise very useful: can review and debug transformations within the IDE.
I wrote a post describing these and a couple of other tools, in case someone is interested: How to test XSL transformations.

Related

How can I see XSLT errors?

I am building some XSL files, but the development goes pretty slow.
Whenever a XSL file has a bug, Google Chrome does not display any errors: neither on the screen nor in the Developer Tools. It just shows a blank page and it's up to us to guess what went wrong.
Do I miss anything? Is there a sane way to do XSL development?
Firstly, many bugs in XSLT stylesheets do not actually result in errors, they simply result in incorrect output, very often blank output. This will happen, for example, if your template match patterns are incorrect (e.g. if you get the namespaces wrong). If your stylesheet is legal XSLT but produces the wrong result, then you're not going to see any errors on the developer console; and indeed few tools will give you much help in this situation.
Schema-aware XSLT was developed as an attempt to address this problem, but it's not going to help you much if you want to run stylesheets in the browser.
A big step forward in XSLT 2.0 was to allow type declarations on variables and parameters. If you use this feature, your bugs will often show up as type-checking failures. The native XSLT processors in the browser only support XSLT 1.0, but you could consider adopting Saxon-JS (alternately, npm "saxon-js" package), which provides XSLT 3.0 support in the browser.
I would recommend doing as much of the development and testing as possible outside the browser environment, using an XML IDE such as Oxygen.

Convert Google test XML report to HTML (console)

I need an example (in some console tool) to convert generated gtest XML report to HTML.
A solution mast be without using ant or Maven.
you should use xslt to transform xml into html.
you could use the xsltproc tool from the command line under linux. I guess there are equivalent tools for other OSes.
I did it for myself with programming language, which is Python 2.*: https://github.com/burlachenkok/gtest_report
Also this gtest_report supports comparision of 2 or more google test results.
If to be honest it was the prime goal.

How can I create a well-formatted PDF?

I'm working on automating our company invoicing system. Currently all data is stored in our local MySQL database and someone manually updates an excel spreadsheet and then merges this data into a MS Word template. The goal is to automate this process so that the invoice can be generated from our intranet website as a PDF.
My original plan was to create a template in HTML/CSS and use wkhtmltopdf to generate the PDF but I ran into problems with getting a repeatable header and footer on each page. thead and tfoot aren't supported by Webkit and the fix suggested in this other question does not seem to work either.
So I then stumbled on using XML and XSL-FO, the latter I know nothing about. Is this the best path to take? Are there any libraries or utilities out there that will make converting my HTML+CSS into XML+XSL-FO easier? Are there any other alternatives I'm overlooking?
EDIT
Currently the server is CentOS Linux with a MySQL database. All other code is currently in PHP currently but that may change as the whole system is being revamped. Linux and MySQL will almost certainly remain, though.
For your requirement, XSL-FO might just do the trick. It is much cleaner to produce the pdf's directly from the data, then going the cumbersome html path, unless you need to display the html as well, then you might consider converting from html to pdf, but it will always be messy.
You can get xml results from mysql quite easily (mysql --xml) and then you write one (or several) xsl-fo stylesheet for the data. then, you cannot only produce pdfs, but also postscript files or rtf's with some processors.
XSL-FO has its limitations tho, but for your situation, it should suffice.
I admit, the learning curve can be steep, and maintaining xslt-stylesheets can get very tiring, but as you start knowing more about it, you end up writing less code.
another possibility is to do the whole thing in e.g. java or c# - send select statements and loop the results and iteratively build the pdf using a library like iText.
You could try JODReports or Docmosis as less-code intensive options. You supply Word or OpenOffice Writer documents to act as templates and use these engines to manipulate/populate the templates then spit out the documents in the format(s) you require. This may mean your existing Word-templates can be used directly which should save you some effort/time.
iText is another library that will let you build and pump out PDFs from code. It's pretty good.
If you cloud use ASP.NET for web you can use free ReportViewer library and designer for automated of publishing PDF-s.
Here is some references:
http://gotreportviewer.com
http://weblogs.asp.net/srkirkland/archive/2007/10/29/exporting-a-sql-server-reporting-services-2005-report-directly-to-pdf-or-excel.aspx
If you're OK using .NET and C#, you could use DotPdf from Atalasoft (obligatory disclaimer: I work for Atalasoft and wrote most of DotPdf). The Generating namespace is geared for exactly what you're trying to do: automate report generation. From the very basics, you could just create docs directly with the toolkit or you can create template documents that have unpopulated text fields that you can reload and fill later (see here and here for examples).

Running XSLT on servers?

Currently I am working on a project for a client that compares the difference between two XML files, generates an XML that lists the differences (i.e. if a part in an inventory was <Added>, <Deleted>, or <Modified>) and displays a report in HTML.
I have three transforms that basically transform large vendor-specific XML files to simple generic XML files (schema defined). These generic XML files are then transformed into one generic XML file that shows the differences and then that is transformed to a report.html for display for the user.
Presently for testing, I invoke a .bat file to run all three transforms (using Saxon8.jar). My question is, is it possible to put these transforms on a server and create a HTML page with a one-click action that will let the user upload the vendor-specific XML files, transform them, and display the generated HTML file to the user?
You haven't specified whether you'll be using php, java or ASP.NET, however, the functionality you're looking for is possible in all three cases. Your backend web app should have the necesssary mechanism to accept the file uploaded by the user, save it in some work folder, run the necessary transformation using your chosen language, Jave, C#, php etc. and then write back the HTML.
Is it possible? Yes.
To do it you'd typically use some server-side technology (php, ruby, java) to perform the transforms.
But browser-side XSLT is possible, too.
Apache Cocoon is a powerful XML processing engine.
If you're just doing this one job, then coding a Java servlet to do it is not too difficult. If you're doing lots of similar things, a framework like Cocoon or Orbeon will save you effort in the long run.

Programmatically generate high quality PDFs

Note: I realize this question has already been asked (with a ruby slant) here: Creating on-demand, print-quality PDFs (preferably in Ruby if feasible). BUT there was no decent answer IMHO.
So as you may have guessed, I am looking to find the best approach to producing HIGH QUALITY, print ready PDF documents programmatically. Our requirements need us to be able to have design documents that define place holders for dynamic content like images and text i.e. some kind of template mechanism.
The suggestion has been to use Adobe's InDesign server, but this seems like an expensive solution not to mention a little overkill for our need.
Are there any alternative, cheaper and more fitting solutions out there? The language of the solution doesn't really matter, just as long as it can be executes on a Windows box.
My suggestion would be to look at XSL-FO or thereabouts...
You create an XML doc that describes what you want and there are various libraries and toolkits (I've used XEP from RenderX) that will convert said XML into PDF.
In real terms what we did was take a large lump of data in XML format, use XSLT - templates in effect - to convert the data to formating objects which XEP renders up into something (a 500 page hotel directory with auto-generated TOC and Index) that has been consumed quite happily by at least three different commercial printers. We did some other smaller documents too from time to time.
Downside with this is that its not even remotely a WYSIWYG solution - you're effectively compiling "source code" to get PDF out the back. Upside is that the base technologies are reasonably generic even if the specific toolkits may be a bit less so.
You can convert XML templates to PDFs with Prince.
Prince is a computer program that
converts XML and HTML into PDF
documents. Prince can read many XML
formats, including XHTML and SVG.
Prince formats documents according to
style sheets written in CSS.
I have and also know many people that have had much success with ReportLab an open source Python PDF library (http://www.reportlab.org/rl_toolkit.html).
Its extremely easy to use and very quick to get started. So worth trying out.
I don't know why no one has suggested using LaTeX for this. It's an extremely popular open format for document design and not hard to set up a template that you can fill in text or image content. While the reference implementation of LaTeX runs as a standalone program, if that sounds like too many moving parts for you there are wrapper libraries for Python and other languages you can call via an API.
Java language and JasperReports
Java: iText
C#: iTextSharp
depends on what you want to publish, but take a look at Pentaho reporting
http://reporting.pentaho.org/
rinohtype is an open-source document processor that is capable of producing high-quality print-ready PDF documents. You can use one of the built-in document templates (book, article) or define your own template. The look of document elements can be configured by means of CSS-like style sheets. The contents of your document can be parsed from reStructuredText or CommonMark files, or you can build the document tree programmatically.
Full disclosure: I am the author of rinohtype.