<?xml-stylesheet href="http://www.w3.org/StyleSheets/base.css" type="text/css"?><?xml-stylesheet href="http://www.w3.org/2002/02/style-xsl.css" type="text/css"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:msg="http://www.w3.org/2007/05/moki/messages" exclude-result-prefixes="html msg">

<!-- Output method XML -->
<xsl:output method="xml" 
  indent="yes"
  omit-xml-declaration="no" 
  encoding="utf-8" 
  doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
  doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"  />


<xsl:template match="/">
  <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
      <title>mobileOK Basic tests</title>
      <style type="text/css">
        .exampleOuter { border: thin gray solid;}
        .kw { font-weight: bold; } 
        .checkerMsg { color: green; }
        .error { color: red;}
        .id { color: gray; font-size:0.8em;}
      </style>
    </head>
    <body>
      <h1>mobileOK Basic tests</h1>
    <xsl:apply-templates select="/html:html//html:div[@class='exampleOuter']"/>
    </body>
  </html>
</xsl:template>


<xsl:template match="html:span[@class='kw' and @id]">
  <xsl:variable name="id" select="@id" />
  <xsl:variable name="msg" select="document('file:///home/dom/dev.w3.org/2007/mobileok-ref/src/org/w3c/mwi/mobileok/basic/xslt/messages.properties.xml')/msg:messages/msg:message[@id=$id]"/>
  <xsl:copy>
    <xsl:apply-templates select="*|@*|comment()|text()"/>
  </xsl:copy>
  <span class='checkerMsg'>
    &#8594; 
    <xsl:choose>
      <xsl:when test="normalize-space($msg)">
        <xsl:value-of select="$msg" />
      </xsl:when>
      <xsl:otherwise>
        <span class="error">No associated message</span>
      </xsl:otherwise>
    </xsl:choose>
  </span>
  <span class='id'>
    [<xsl:value-of select="$id" />]
  </span>
</xsl:template>

  <!-- default: Identity Transformation -->
  <xsl:template match="*|@*|comment()|text()">
    <xsl:copy>
      <xsl:apply-templates select="*|@*|comment()|text()"/>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>
