XML reporting

Posted on 2014-01-15
Last Modified: 2014-01-30
1. I will generate/update a XML file based on an activity (sort of audit)
2. When ever I require, I would like to read this XML and generate a HTML report.
3. I have an apache server installed on one of my server, If possible I would like to use this web server to generate the report based on step 1 XML.
4. If I use XSLT, then what else I need to have on the apache server (like parser etc)
5. Wish to retreive subset of data from XML, and wish to SORT those in HTML if possible.

Please help with examples. or advise a better way. (or even any less expensive product that I can use)

Thanks in advance
Question by:enthuguy
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Expert Comment

ID: 39782109
If you use XSLT simply as a stylesheet of the XML file then the transformation takes place on the client side (i.e. in the browser). Your XML should look like this: (of course names and encoding may vary)

<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet type="text/xsl" href="somestylesheet.xsl" ?>

<somesingletag someattr="somevalue">

Open in new window

If you apply the XSLT on the XML in a dynamic way, e.g. within a PHP page, then it really depends on what exactly your runtime environment is. E.g. for Ubuntu + PHP, you need the php5-xsl package (and all its requirements of course). I'm a bit too lazy to dig up a self-contained PHP example though :)

(edit: examples)

Expert Comment

by:Mahesh Bhutkar
ID: 39784529
There are various libraries/open source available to transform xml using xslt on different different platform.

The simplest way where you don't even have to use any library is use Javascript to transform xml document using xslt.

Here is an example which you can refer,

Accepted Solution

Surrano earned 500 total points
ID: 39784565
Simplest is to use the <?xml-stylesheet> tag but if you need some dynamics, e.g. URL parameters, it is an option to use javascript indeed. The essence (as we use it) is:
function getURLParam(paramname) {
  if (query.length > 0){
    var params=query.split("&");
    for (var i=0 ; i<params.length ; i++){
      var pos = params[i].indexOf("=");
      var name = params[i].substring(0, pos);
      if (name==paramname) {
	var value = params[i].substring(pos + 1);
	return value;
  return null;

function procParam(paramname) {
  var param = getURLParam(paramname);
  if (param != null)
    if (isDom)
      proc.setParameter(null, paramname, param);
      proc.addParameter(paramname, param);
function init() {
  var xslFile = "collect.xsl";
  var xmlFile = "collect.xml";

  if (document.implementation && document.implementation.createDocument)
    isDom = true;
  if (isDom) {
    xsl = document.implementation.createDocument("", "test", null);
    xml = document.implementation.createDocument("", "test", null);
  } else {
    xslt = new ActiveXObject("Msxml2.XSLTemplate");
    xsl = new ActiveXObject("Msxml2.FreeThreadedDOMDocument");
    xml = new ActiveXObject("Msxml2.FreeThreadedDOMDocument");

  xsl.async = false; xsl.load(xslFile);
  xml.async = false; xml.load(xmlFile);

  if (isDom) {
    proc = new XSLTProcessor();
  } else {
    xslt.stylesheet = xsl.documentElement;
    proc = xslt.createProcessor();
    proc.input = xml;


  if (isDom) {
    var fragment = proc.transformToFragment(xml, document);
  } else {

Open in new window

and the xsl refers to the params (host, module, mode, list, graph) like this:

<xsl:stylesheet version="1.0" xmlns:xsl="">
  <xsl:output method="html"/>
  <xsl:param name="host"/>
  <xsl:param name="module"/>
  <xsl:param name="mode"/>
  <xsl:param name="list"/>
  <xsl:param name="graph" select="no"/>

Open in new window


Expert Comment

by:Mahesh Bhutkar
ID: 39799622
Enthuguy, Any update on this?

Author Closing Comment

ID: 39822632


Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C# XML Get Values 4 37
Popup write two lines 3 22
How do I show a login page over the login page? 5 41
HTML question 2 28
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question