<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:len="http://www.xfront.com/owl/ontologies/Length/#"
                xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                version="2.0">
 
    <xsl:output method="html"/>

    <xsl:include href="Length-Include-File.xsl"/>

    <xsl:template match="/">
        <HTML>
            <BODY>
                <xsl:apply-templates/>
            </BODY>
        </HTML>
    </xsl:template>

    <xsl:template match="len:Length[len:units/@rdf:resource!='http://www.xfront.com/owl/ontologies/Length/#Kilometre']
                                   [len:units/@rdf:resource!='http://www.xfront.com/owl/ontologies/Length/#Metre']">
        <xsl:text>The input data in not in the preferred format (Kilometre) nor in the canonical format (Metre).  Converting ...</xsl:text><br/>
        <xsl:variable name="canonical-Length" select="len:Length(.)"/>
        <xsl:apply-templates select="$canonical-Length"/>
    </xsl:template>

    <xsl:template match="len:Length[len:units/@rdf:resource='http://www.xfront.com/owl/ontologies/Length/#Kilometre']">
        <xsl:text>The input data is in the preferred Kilometre format</xsl:text><p/>
    </xsl:template>

    <xsl:template match="len:Length[len:units/@rdf:resource='http://www.xfront.com/owl/ontologies/Length/#Metre']">
        <xsl:text>Either the input data was originally in the canonical format, or it was converted to the canonical format</xsl:text><p/>
    </xsl:template>

</xsl:stylesheet>