Project Report

Version

Date

Changes

1.0

2010-09-01

Initial version.

Description

This report enumerates the definitions in a WebWorks project (.wep). Also works with stationary.

See attachments for sample report.

NOTE: It only works with FireFox browser -- tested in 3.6.8. (I gave up trying to track down the apparent XML namespace problems in IE 8 I had it working at one point).

How it works

There are three files:

To use the report:

  1. Put the three files in a directory.
  2. Copy the WebWorks project (wep) or stationary into the same directory.

  3. Open report_project.html in the Web browser.

    1. When prompted, enter the project name.
    2. The second prompt is an optional comment you can add to annotate the report.
    The report appears in the browser.

Caveats

The files

All files are in the attached ZIP file.

Descriptions and listings of the files.

report_project.html

To be opened in the Web browser. Prompts for the project name and displays the generated HTML.

Note: The code for IE is not set up to pass the parameters. I never got around to it.

<html>
<head>
    <title>WebWorks Project Report</title>
<link rel="StyleSheet" href="webworks-project.css" type="text/css" media="all" />
<script>
function loadXMLDoc(dname)
{
    if (window.XMLHttpRequest)
      {
      xhttp=new XMLHttpRequest();
      }
    else
      {
      xhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xhttp.open("GET",dname,false);
    xhttp.send("");
    return xhttp.responseXML;
}

function displayResult()
{

    var wep_filename="help.wep";
    wep_filename = prompt("Name of the WW project", wep_filename);

    var comment=prompt("Optional comments ","");

    xml=loadXMLDoc(wep_filename);
    xsl=loadXMLDoc("wwproject.xsl");


    var currentTime = new Date()
    var month = currentTime.getMonth() + 1
    var day = currentTime.getDate()
    var year = currentTime.getFullYear()
    currentDate = month + "/" + day + "/" + year;


    // code for IE
    if (window.ActiveXObject)
      {
      ex=xml.transformNode(xsl);
      document.getElementById("body-div").innerHTML=ex;
      }
    // code for Mozilla, Firefox, Opera, etc.
    else if (document.implementation && document.implementation.createDocument)
      {
      xsltProcessor=new XSLTProcessor();
      xsltProcessor.importStylesheet(xsl);

      xsltProcessor.setParameter(null,"filename", wep_filename);
      xsltProcessor.setParameter(null,"current-date", currentDate);
      xsltProcessor.setParameter(null,"comment", comment);

      resultDocument = xsltProcessor.transformToFragment(xml,document);
      document.getElementById("body-div").appendChild(resultDocument);
      }
}
</script>
</head>
<body onload="displayResult()">
<div id="body-div" />
</body>
</html>

wwproject.xsl

Parses the project file and generated HTML.

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ww="urn:WebWorks-Publish-Project"
    xmlns="urn:WebWorks-Publish-Project"
    xmlns:html="http://www.w3.org/1999/xhtml"
    >

<xsl:param name="filename" />
<xsl:param name="current-date" />
<xsl:param name="comment" />


<xsl:template match="/">
  <html >
  <html:link rel="StyleSheet" href="webworks-project.css" type="text/css" media="all" />
  <html:body>

    <html:h1>Project: <xsl:value-of select="$filename" /> </html:h1>
    <html:p class="asOfDate">as of <xsl:value-of select="$current-date" /> </html:p>
    <html:p class="wwVersion">WebWorks Project Version: <xsl:value-of select="ww:Project/@Version"/> </html:p>

    <xsl:if test="string($comment) != '' ">
        <html:div class="comment">
        <html:p class="comment">Comment: <xsl:value-of select="$comment" /></html:p>
        </html:div>
    </xsl:if>

    <xsl:apply-templates/>
  </html:body>
  </html>
</xsl:template>


<xsl:template match="ww:Origin">
  <html:h2>Origin</html:h2>

  <html:div class="rule-type">
  <html:table border="0" >
  <html:tr>
  <html:td><xsl:value-of select="."/></html:td>
  </html:tr>
  </html:table>
  </html:div>

</xsl:template>



<xsl:template match="ww:Formats/ww:Format">
  <html:h2>Formats</html:h2>

  <html:div class="rule-type">
  <html:table border="0" >
  <html:tr><html:td>TargetName:&#160;&#160;</html:td><html:td><xsl:value-of select="@TargetName"/></html:td></html:tr>
  <html:tr><html:td>Name:&#160;&#160;</html:td><html:td><xsl:value-of select="@Name"/></html:td></html:tr>
  <html:tr><html:td>Type:&#160;&#160;</html:td><html:td><xsl:value-of select="@Type"/></html:td></html:tr>
  </html:table>
  </html:div>

</xsl:template>




<xsl:template match="ww:GlobalConfiguration">
  <html:h2>Rules</html:h2>
     <xsl:apply-templates/>
</xsl:template>


<!-- ****** -->
<xsl:template match="ww:Rules">
  <html:h3><xsl:value-of select="@Type"/>s&#160;&#160;<html:span style="font-size:small;font-weight:normal"><html:em>Default is</html:em>&#160;&#160;<html:b><xsl:value-of select="@Default"/></html:b></html:span></html:h3>

  <html:div class="rule-type">
      <xsl:apply-templates/>
  </html:div>
</xsl:template>

<xsl:template match="ww:Rule">

    <html:table border="0" cellpadding="0" cellspacing="0" width="100%">
    <html:tr>
    <html:td align="left"><html:b><xsl:value-of select="@Key"/> </html:b></html:td>
    <html:td align="right">&#160;<xsl:if test="@ParentRule"><html:em>Parent rule is </html:em>&#160;&#160;<html:b><xsl:value-of select="@ParentRule"/>&#160;</html:b></xsl:if></html:td>
    </html:tr>
    </html:table>

    <html:div class="rule">
    <xsl:if test='ww:Options[.!=""]'>
    <html:table border="0" width="100%">
      <html:tr bgcolor="#ddffdd">
        <html:th width="220pt">Option</html:th>
        <html:th width="">Value</html:th>
        <html:th width="80pt">Source</html:th>
      </html:tr>
      <xsl:apply-templates  select="ww:Options"/>
    </html:table>
    </xsl:if>


    <xsl:if test='ww:Properties[.!=""]'>
    <html:table border="0" width="100%">
      <html:tr bgcolor="#dddddd">
        <html:th width="220pt">Property</html:th>
        <html:th width="">Value</html:th>
        <html:th width="80pt">Source</html:th>
      </html:tr>
      <xsl:apply-templates  select="ww:Properties"/>
    </html:table>
    </xsl:if>
    </html:div>

</xsl:template>

<xsl:template match="ww:Option">
  <html:tr>
    <html:td><xsl:value-of select="@Name"/></html:td>
    <html:td><xsl:value-of select="@Value"/></html:td>
    <html:td><xsl:value-of select="@Source"/></html:td>
  </html:tr>
</xsl:template>

<xsl:template match="ww:Property">
  <html:tr>
    <html:td><xsl:value-of select="@Name"/></html:td>
    <html:td><xsl:value-of select="@Value"/></html:td>
    <html:td><xsl:value-of select="@Source"/></html:td>
  </html:tr>
</xsl:template>

<!-- **** FormatConditions **** -->
<xsl:template match="ww:FormatConfigurations">
  <html:h2>Format Configurations</html:h2>
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="ww:Conditions">
  <html:h4>Conditions</html:h4>
  <html:div class="rule">
  <html:table border="0" width="100%">
    <html:tr bgcolor="#dddddd">
      <html:th width="220pt">Condition</html:th>
      <html:th width="">Value</html:th>
      <html:th width="">Passthrough</html:th>
      <html:th width="80pt">UseDocumentValue</html:th>
    </html:tr>
    <xsl:apply-templates />
  </html:table>
  </html:div>
</xsl:template>

<xsl:template match="ww:Condition">
  <html:tr>
    <html:td><xsl:value-of select="@Name"/></html:td>
    <html:td><xsl:value-of select="@Value"/></html:td>
    <html:td><xsl:value-of select="@Passthrough"/></html:td>
    <html:td><xsl:value-of select="@UseDocumentValue"/></html:td>
  </html:tr>
</xsl:template>


<xsl:template match="ww:Variables">
  <html:h4>Variables</html:h4>
  <html:div class="rule">
  <html:table border="0" width="100%">
    <html:tr bgcolor="#dddddd">
      <html:th width="220pt">Variable</html:th>
      <html:th width="">Value</html:th>
      <html:th width="80pt">UseDocumentValue</html:th>
    </html:tr>
    <xsl:apply-templates />
  </html:table>
  </html:div>
</xsl:template>

<xsl:template match="ww:Variable">
  <html:tr>
    <html:td><xsl:value-of select="@Name"/></html:td>
    <html:td><xsl:value-of select="@Value"/></html:td>
    <html:td><xsl:value-of select="@UseDocumentValue"/></html:td>
  </html:tr>
</xsl:template>

<xsl:template match="ww:XRefFormatSet">
    <xsl:apply-templates />
</xsl:template>


<xsl:template match="ww:XRefFormats">
  <html:h4><xsl:value-of select="@Adapter"/> adapter</html:h4>
  <html:div class="rule">
  <html:table border="0" width="100%">
    <html:tr bgcolor="#dddddd">
      <html:th width="220pt">Format</html:th>
      <html:th width="">Value</html:th>
    </html:tr>
    <xsl:apply-templates />
  </html:table>
  </html:div>
</xsl:template>

<xsl:template match="ww:XRefFormat">
  <html:tr>
    <html:td><xsl:value-of select="@Key"/></html:td>
    <html:td><xsl:value-of select="@Value"/></html:td>
  </html:tr>
</xsl:template>

<xsl:template match="ww:FormatSettings">
  <html:h4>Format Settings</html:h4>
  <html:div class="rule">
  <html:table border="0" width="100%">
    <html:tr bgcolor="#dddddd">
      <html:th width="220pt">Setting</html:th>
      <html:th width="">Value</html:th>
    </html:tr>
    <xsl:apply-templates />
  </html:table>
  </html:div>
</xsl:template>

<xsl:template match="ww:FormatSetting">
  <html:tr>
    <html:td><xsl:value-of select="@Name"/></html:td>
    <html:td><xsl:value-of select="@Value"/></html:td>
  </html:tr>
</xsl:template>


<xsl:template match="ww:MergeSettings">
    <!-- We don't use this, I think ... -->
</xsl:template>


<!-- **** ProjectSettings **** -->
<xsl:template match="ww:ProjectSettings">
    <!-- We don't use this, I think ... -->
    <!--
    <h2>ProjectSettings</h2>
    -->
</xsl:template>

</xsl:stylesheet>

webworks-project.css

CSS used to format the generated HTML.

body {
    width: 650pt;
    font-family:        'Trebuchet MS', Arial, Verdana, Helvetica, sans-serif;
}

#body-div {
    width: 665pt;
    border: 0;
    margin-left: 0;
}

div {
    border: dotted 1px #dddddd;
    margin-left: 1em;
}

div.rule-type {
    background-color: #ffffff;
    width: 635pt;
}

div.rule {
    background-color: #ffffcf;
    margin-bottom: 1em;
    width: 612pt;
}

div.comment {
    width: 60%;
    margin-left: auto ;
    margin-right: auto ;
    padding: 10pt;
}

p {
    font-size: 9pt;
}
p.asofDate {
    text-align: center;
    margin-bottom: 0;
}
p.wwVersion {
    text-align: center;
    margin-top: 0;
}

p.comment {
    text-align: left;
    margin: 0;
}

h1 {
    text-align: center;
    margin-bottom: 8pt;
}

h2 {
    background-color: #dddddd;
}

h3 {
    background-color: #ddddfd;
}

h4 {
    margin-top: 0;
    margin-bottom: 0;
}

td  {
    font-size: 9pt;

}
th  {
    text-align: left;
    font-size: 9pt;
}


CategorySolutions

DevCenter/Projects/Reports/Project report (last edited 2010-09-01 17:00:17 by MikeHedblom)