<?xml version="1.0"?>
<!-- This is a modification of "versioning.xsl".  That stylesheet gives
     Good Practice Notes, etc.  This one adds "discussion points". -->
<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="http://www.w3.org/2001/tag/doc/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 }
.highlight  { background: yellow }

div.exampleOuter {border: 4px double gray;
                  margin-left:5% ; margin-right: 5%;  padding: 0em}

em 	    { font-style: italic; }
code        {font-family: monospace;}
pre    {font-family: monospace;}
pre         { margin-left: 5%}

.discussionPoint { font-style: italic; margin-left: 5%; margin-right: 5% }
</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>

<!--
# Added by Noah as simple means of getting
# something that's in between an example
# and a regular paragraph in terms
# of typographic emphasis
#   -->

<xsl:template match="discussionPoint">
  <xsl:param name="node" select="."/>
  <xsl:param name="conditional" select="1"/>
  <xsl:param name="default.id" select="''"/>

  <xsl:variable name="id">
    <xsl:call-template name="object.id">
      <xsl:with-param name="node" select="$node"/>
      <xsl:with-param name="default.id" select="$default.id"/>
    </xsl:call-template>
  </xsl:variable>
  <xsl:if test="$conditional = 0 or $node/@id">
   <!-- should this be a paragraph? -->
   <div id="{$id}" class="discussionPoint">
        <xsl:apply-templates/>
   </div>
  </xsl:if>
   
</xsl:template>

  <!-- highlight -->
  <!-- The yellow highlighter look - for editorial work -->
  <xsl:template match="highlight">
    <span>
      <xsl:attribute name="class">
	highlight
      </xsl:attribute>
      <xsl:apply-templates/>
    </span>
  </xsl:template>

</xsl:stylesheet>
