XML-CompareML / extradata / compare-ml.xslt

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
 doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"

<xsl:key name="impl" match="/comparison/meta/implementations/impl" use="@id"/>

<xsl:template match="/comparison">
<html xmlns="http://www.w3.org/1999/xhtml">
<title><xsl:value-of select="contents/section[@id='main']/title"/></title>
<style type="text/css">
h2 { background-color : #98FB98; /* PaleGreen */ }
h3 { background-color : #FFA500; /* Orange */ }
    margin-left : 1em;
    margin-right : 1em; 
    width: 90%;
    max-width : 40em;
.compare td 
    border-color : black; border-style : solid ; border-width : thin;
    vertical-align : top;
    padding : 0.2em;
    list-style-type : none ; padding-left : 0em;
.toc ul
    list-style-type : none ; 
    padding-left : 0em; 
    margin-left : 2em;
    border-style : solid ; border-width : thin;
    background-color : #E6E6FA; /* Lavender */
    border-color : black;
    padding : 0.3em;
a:hover { background-color : yellow }
tt { color : #8A2BE2 /* The BlueViolet Color */ }
<xsl:apply-templates select="contents"/>

<xsl:template match="contents">
    <xsl:apply-templates select="section"/>

<xsl:template match="section">
    <xsl:element name="h{count(ancestor-or-self::section)}">
        <xsl:attribute name="id">
            <xsl:value-of select="@id"/>
        <xsl:value-of select="title"/>
    <xsl:apply-templates select="expl"/>
    <xsl:if test="@id = 'main'">
        <xsl:if test="/comparison/meta/timestamp">
                <tt><xsl:value-of select="/comparison/meta/timestamp"/></tt>
        <ul class="toc">
            <xsl:apply-templates select="section" mode="toc"/>
    <xsl:apply-templates select="section"/>
    <xsl:apply-templates select="compare"/>

<xsl:template match="section" mode="toc">
        <a href="#{@id}"><xsl:value-of select="title"/></a>
        <xsl:if test="section">
                <xsl:apply-templates select="section" mode="toc"/>

<xsl:template match="expl">
 <p class="expl">
 <xsl:value-of select="."/>

<xsl:template match="compare">
 <table class="compare">
  <xsl:apply-templates select="//comparison/meta/implementations/impl">
  <xsl:with-param name="curcomp" select="." />

<xsl:template match="impl">
<xsl:param name="curcomp" />
<xsl:variable name="curid" select="@id" />
<xsl:apply-templates select="$curcomp/s[@id=$curid]" />

<xsl:template match="s">
 <td class="sys"><xsl:value-of select="key('impl', @id)/name"/></td>
 <td class="desc"><xsl:apply-templates/></td>

<xsl:template match="a">
    <a href="{@href}"><xsl:apply-templates/></a>

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.