I need to transform XML file into HTML.
What options do I have? Is there any python tool for it?
ADDED
On my mac, I found xsltproc, and I could run it as follows
xsltproc xslt.xml hello.xml
Generally speaking, XSLT is for various XML translations. I'm sure you can find Python library for it.
Related
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.
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.
I've made an XML schema but I don't know if I need an XSL stylesheet to show it in HTML. Do I need one? If I do, has anyone got an example which I could see and learn how to make one for my XML schema?
For an XSLT solution take a look at:
XS3P
XSDDoc, which produces JavaDoc-like documentation.
There are also a variety of tools that can produce W3C Schema documentation, such as:
oXygen
Stylus Studio
XML Schema Documenter
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.
Is there a place I can find Backus–Naur Form or BNF grammars for popular languages? Whenever I do a search I don't turn up much, but I figure they must be published somewhere. I'm most interested in seeing one for Objective-C and maybe MySQL.
you have to search on tools used to create grammars: "lex/yacc grammar", "antlr grammar" "railroad diagram"
http://www.antlr3.org/grammar/list.html
Here's some grammar files
objective-c
http://www.omnigroup.com/mailman/archive/macosx-dev/2001-March/022979.html
http://www.cilinder.be/docs/next/NeXTStep/3.3/nd/Concepts/ObjectiveC/B_Grammar/Grammar.htmld/index.html
https://github.com/pornel/objc2grammar
python
http://www.python.org/dev/summary/2006-04-16_2006-04-30/#the-grammar-file-and-syntaxerrors
javascript
http://tomcopeland.blogs.com/EcmaScript.html
http://www.ccs.neu.edu/home/dherman/javascript/
ruby
http://www.ruby-doc.org/docs/ruby-doc-bundle/Manual/man-1.4/yacc.html
FWIW, the MySQL grammar file (mysql-server/sql/sql_yacc.y) is open source and browseable at launchpad.net (though it's a bit slow and I got an error when I tried to pull up the specific file).
Also, a snapshot of the whole MySQL Server source is downloadable from dev.mysql.com.
There are some links from w:BNF#Language Grammars.
BNF Grammars for SQL-92, SQL-99 and SQL-2003
I also found a page that lists grammars for Objective C.
Objective-C grammar for Lex/Yacc Flex/Bison
Reference Manual for the Objective-C Language
IIRC, BNF grammars are just different enough from what yacc/bison want as input to be really annoying :) If you intend to feed these files into a parser generator, you may want to look for files in the appropriate format. I recall seeing such files for Java, JavaScript and C++ at one point. Probably as part of Eclipse, Firefox and GCC, respectively, but I can't remember for sure. I would assume you can find pretty much any parser input file by finding an open source project that uses that language.
I also searched this and i collected this repository
http://slps.github.io/zoo/