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

<!-- Changed by Noah, was import for "/projects/w3c/spec-prod/html/xmlspec.xsl" -->
<xsl:import href="./xmlspec.xsl"/>

<xsl:param name="additional.css">
p { clear: both }

.prefix { float:left; width: 15%; background: yellow; color: black;
border: solid black thin; padding: .1em; margin-left: 2%;
margin-right: 2%;}

.principle, .constraint, .property, .practice { color: black; border:
solid black thin; padding: .1em; margin-left: 5%; margin-right: 5%; clear: none}

.principle  { background: #f7ebd7 }
.constraint { background: #becece }
.property   { background: #f7ebd7 }
.practice   { background: #dfffff }

pre em      { font-style: italic;
              font-weight: bold;
            }

.editorialNeedsWork { color:red; font-weight:bold }
</xsl:param>

<xsl:template match="p[@role]">
  <p class="prefix">
    <xsl:choose>
      <xsl:when test="@role = 'principle'">Principle</xsl:when>
      <xsl:when test="@role = 'practice'">Good Practice</xsl:when>
      <xsl:when test="@role = 'constraint'">Constraint</xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="@role"/>
      </xsl:otherwise>
    </xsl:choose>
  </p>
  <xsl:apply-imports/>
</xsl:template>

<!-- why isn't this the default? -->

<xsl:template match="example/head">
  <xsl:text>&#10;</xsl:text>
  <xsl:choose>
    <xsl:when test="$tabular.examples = 0">
      <div class="exampleHeader">
        <xsl:call-template name="anchor">
          <xsl:with-param name="node" select=".."/>
          <xsl:with-param name="conditional" select="0"/>
        </xsl:call-template>

        <xsl:text>Example </xsl:text>
        <xsl:number from="/" level="any" count="example"/>
        <xsl:text>: </xsl:text>
        <xsl:apply-templates/>
      </div>
    </xsl:when>
    <xsl:otherwise>
      <h5>
        <xsl:call-template name="anchor">
          <xsl:with-param name="node" select=".."/>
          <xsl:with-param name="conditional" select="0"/>
        </xsl:call-template>

        <xsl:text>Example </xsl:text>
        <xsl:number from="/" level="any" count="example"/>
        <xsl:text>: </xsl:text>
        <xsl:apply-templates/>
      </h5>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

<xsl:template match="example/head" mode="specref">
  <xsl:variable name="id">
    <xsl:call-template name="object.id">
      <xsl:with-param name="node" select=".."/>
    </xsl:call-template>
  </xsl:variable>

  <a href="#{$id}">
    <xsl:text>Example </xsl:text>
    <xsl:number from="/" level="any" count="example"/>
  </a>
</xsl:template>

</xsl:stylesheet>

