-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 
-->
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 
-->
-<!--
	
	Common Text Primitives  to XHTML Converter
	
	Author:
	Name  : Hugh Field-Richards.
	Email : hsfr@hsfr.org.uk
	
	-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
	-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
	
	Date                   Who    Changes
	==========================================================================
	
   January 2006           HSFR   Created
   8th August 2006        HSFR   Changed para and headings to use <p> and <hx>
   18th October 2006      HSFR   Added news text
   8th November 2006      HSFR   Rewritten quotes
   5th June 2009          HSFR   Updated t:note
   25th August 2010       HSFR   Minor changes to remove raw HTML tags
  
-->
-<xsl:stylesheet version="1.0" __file="00162e1a29a2d315e2095949ce88de5f" __status="-1" xmlns:notebook="http://www.hsfr.org.uk/Schema/Notebook" xmlns:graphic="http://www.hsfr.org.uk/Schema/Graphic" xmlns:news="http://www.hsfr.org.uk/Schema/News" xmlns:xlink="http://www.hsfr.org.uk/Schema/Xlink" xmlns:t="http://www.hsfr.org.uk/Schema/Text" xmlns:person="http://www.hsfr.org.uk/Schema/Person" xmlns:address="http://www.hsfr.org.uk/Schema/Address" xmlns:copyright="http://www.hsfr.org.uk/Schema/Copyright" xmlns:link="http://www.hsfr.org.uk/Schema/Link" xmlns:list="http://www.hsfr.org.uk/Schema/List" xmlns:form="http://www.hsfr.org.uk/Schema/Form" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-* TEXT PRIMITIVES *-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<xsl:template match="t:p" mode="inline-text">
-<xsl:element name="p">
<xsl:attribute name="class">normalPara</xsl:attribute>
<xsl:apply-templates mode="inline-text"/>
</xsl:element>
</xsl:template>
-<xsl:template match="news:text" mode="inline-text">
<xsl:apply-templates mode="inline-text"/>
</xsl:template>
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<xsl:template match="t:verbatim" mode="inline-text">
-<xsl:element name="div">
<xsl:attribute name="class">verbatimTable</xsl:attribute>
-<xsl:if test="@title">
-<xsl:element name="div">
<xsl:attribute name="class">verbatimTitle</xsl:attribute>
<xsl:value-of select="@title"/>
</xsl:element>
</xsl:if>
-<xsl:element name="div">
<xsl:attribute name="class">verbatimCode</xsl:attribute>
<xsl:apply-templates mode="inline-text"/>
</xsl:element>
</xsl:element>
</xsl:template>
-<xsl:template match="t:addition" mode="inline-text">
-<xsl:element name="span">
<xsl:attribute name="class">addition</xsl:attribute>
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
-<xsl:template match="t:deletion" mode="inline-text">
-<xsl:element name="span">
<xsl:attribute name="class">deletion</xsl:attribute>
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
-<xsl:template match="t:cmd" mode="inline-text">
-<xsl:element name="span">
<xsl:attribute name="class">commandEntry</xsl:attribute>
<xsl:apply-templates mode="inline-text"/>
</xsl:element>
</xsl:template>
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<xsl:template match="t:code" mode="inline-text">
-<xsl:choose>
-<xsl:when test="@type = 'dir'">
-<xsl:element name="span">
<xsl:attribute name="class">code-dir</xsl:attribute>
<xsl:apply-templates mode="inline-text"/>
</xsl:element>
</xsl:when>
-<xsl:when test="@type = 'var'">
-<xsl:element name="span">
<xsl:attribute name="class">code-var</xsl:attribute>
<xsl:apply-templates mode="inline-text"/>
</xsl:element>
</xsl:when>
-<xsl:when test="@type = 'tag'">
-<xsl:element name="span">
<xsl:attribute name="class">code-dir</xsl:attribute>
<
<xsl:apply-templates mode="inline-text"/>
>
</xsl:element>
</xsl:when>
-<xsl:otherwise>
<xsl:apply-templates mode="inline-text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<xsl:template match="t:foreignWord" mode="inline-text">
-<xsl:element name="span">
<xsl:attribute name="class">foreignWord</xsl:attribute>
<xsl:apply-templates mode="inline-text"/>
</xsl:element>
</xsl:template>
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<!--
 
		Note that there will always be an id here generated from previous stages of the pipe.
	
-->
-<xsl:template match="t:heading" mode="inline-text">
-<xsl:element name="{concat( 'h', @level )}">
-<xsl:attribute name="class">
heading-
<xsl:value-of select="@level"/>
</xsl:attribute>
-<xsl:if test="@id">
-<xsl:element name="a">
-<xsl:attribute name="name">
<xsl:value-of select="@id"/>
</xsl:attribute>
</xsl:element>
</xsl:if>
<xsl:apply-templates mode="inline-text"/>
</xsl:element>
</xsl:template>
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<xsl:template match="t:newline" mode="inline-text">
<xsl:element name="br"/>
</xsl:template>
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<xsl:template match="t:quote" mode="inline-text">
-<xsl:choose>
-<xsl:when test="@type='para'">
-<xsl:element name="div">
<xsl:attribute name="class">paraQuote</xsl:attribute>
<xsl:text>"</xsl:text>
<xsl:apply-templates mode="inline-text"/>
<xsl:text>"</xsl:text>
</xsl:element>
-<xsl:element name="div">
<xsl:attribute name="class">whoQuote</xsl:attribute>
-<xsl:choose>
-<xsl:when test="@ref">
-<xsl:element name="a">
-<xsl:attribute name="href">
<xsl:value-of select="@ref"/>
</xsl:attribute>
-<xsl:attribute name="target">
<xsl:value-of select="'quote'"/>
</xsl:attribute>
<xsl:value-of select="@who"/>
</xsl:element>
</xsl:when>
-<xsl:otherwise>
<xsl:value-of select="@who"/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:when>
-<xsl:otherwise>
-<xsl:element name="span">
<xsl:attribute name="class">charQuote</xsl:attribute>
<xsl:apply-templates mode="inline-text"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<xsl:template match="list:list" mode="inline-text">
-<xsl:choose>
-<xsl:when test="@type='ordered' or @type='numbered'">
-<xsl:element name="ol">
<xsl:apply-templates mode="inline-text"/>
</xsl:element>
</xsl:when>
-<xsl:when test="@type='unordered'">
-<xsl:element name="ul">
<xsl:apply-templates mode="inline-text"/>
</xsl:element>
</xsl:when>
</xsl:choose>
</xsl:template>
-<xsl:template match="list:item" mode="inline-text">
-<xsl:element name="li">
<xsl:attribute name="class">listItem</xsl:attribute>
<xsl:apply-templates mode="inline-text"/>
</xsl:element>
</xsl:template>
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<xsl:template match="link:link" mode="inline-text">
<xsl:variable name="ref" select="@ref"/>
-<xsl:choose>
-<xsl:when test="@type='uri'">
-<xsl:element name="a">
-<xsl:attribute name="href">
<xsl:value-of select="$ref"/>
</xsl:attribute>
-<xsl:attribute name="id">
-<xsl:variable name="idString">
-<xsl:call-template name="common.substring-after-last">
<xsl:with-param name="string" select="substring-after(@ref, '/')"/>
<xsl:with-param name="delimiter" select="'/'"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="substring-before( $idString, '.' )"/>
</xsl:attribute>
-<xsl:if test="@target">
-<xsl:attribute name="target">
<xsl:value-of select="@target"/>
</xsl:attribute>
</xsl:if>
-<xsl:if test="@target='pop'">
-<xsl:attribute name="onclick">
window.open('
<xsl:value-of select="$ref"/>
','
<xsl:value-of select="$ref"/>
','width=500,height=600,top=200,left=200,resize=yes,scrollbars=yes'); return false;
</xsl:attribute>
</xsl:if>
-<xsl:choose>
-<xsl:when test=".">
<xsl:apply-templates mode="inline-text"/>
</xsl:when>
-<xsl:otherwise>
<xsl:value-of select="$ref"/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:when>
-<xsl:when test="@type='email'">
-<xsl:element name="a">
-<xsl:attribute name="href">
mailto:
<xsl:value-of select="$ref"/>
</xsl:attribute>
-<xsl:choose>
-<xsl:when test="not ( . = '' )">
<xsl:apply-templates mode="inline-text"/>
</xsl:when>
-<xsl:otherwise>
<xsl:value-of select="$ref"/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:when>
-<xsl:when test="@type='anchor'">
-<xsl:element name="a">
-<xsl:attribute name="name">
<xsl:value-of select="@ref"/>
</xsl:attribute>
<xsl:apply-templates mode="inline-text"/>
</xsl:element>
</xsl:when>
-<xsl:otherwise>
-<xsl:element name="a">
-<xsl:attribute name="href">
#
<xsl:value-of select="@ref"/>
</xsl:attribute>
<xsl:apply-templates mode="inline-text"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<!--
      Typical XML In
      ==========================================================================
      <t:group img="keyboard.png" alt="keyboard" pos="right" >
         <t:p>...</t:p>
      </t:group>
      ==========================================================================
      
   
-->
-<xsl:template match="t:group" mode="inline-text">
-<xsl:choose>
-<xsl:when test="@img">
-<xsl:call-template name="outputGraphic">
<xsl:with-param name="pos" select="@pos"/>
<xsl:with-param name="ref" select="@img"/>
<xsl:with-param name="alt" select="@alt"/>
</xsl:call-template>
<xsl:apply-templates mode="inline-text"/>
-<xsl:element name="br">
<xsl:attribute name="clear">all</xsl:attribute>
</xsl:element>
</xsl:when>
-<xsl:otherwise>
<xsl:apply-templates mode="inline-text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<xsl:template match="graphic:graphic" mode="inline-text">
-<xsl:element name="div">
<xsl:attribute name="class">imgBox</xsl:attribute>
<xsl:attribute name="align">center</xsl:attribute>
-<xsl:element name="img">
<xsl:attribute name="class">imgBox</xsl:attribute>
-<xsl:attribute name="src">
<xsl:value-of select="@ref"/>
</xsl:attribute>
-<xsl:attribute name="alt">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:template>
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<xsl:template name="outputGraphic">
<xsl:param name="width"/>
-<!--
 optional graphic width 
-->
<xsl:param name="height"/>
-<!--
 optional graphic height 
-->
<xsl:param name="ref"/>
<xsl:param name="pos"/>
<xsl:param name="alt"/>
<xsl:param name="name"/>
-<xsl:element name="img">
<xsl:attribute name="border">0</xsl:attribute>
-<xsl:attribute name="src">
<xsl:value-of select="$ref"/>
</xsl:attribute>
-<xsl:if test="$name">
-<xsl:attribute name="alt">
<xsl:value-of select="$name"/>
</xsl:attribute>
</xsl:if>
-<xsl:if test="$pos">
-<xsl:attribute name="align">
<xsl:value-of select="$pos"/>
</xsl:attribute>
</xsl:if>
-<xsl:if test="$alt">
-<xsl:attribute name="alt">
<xsl:value-of select="$alt"/>
</xsl:attribute>
</xsl:if>
-<xsl:if test="$width">
-<xsl:attribute name="width">
<xsl:value-of select="$width"/>
</xsl:attribute>
</xsl:if>
-<xsl:if test="$height">
-<xsl:attribute name="height">
<xsl:value-of select="$height"/>
</xsl:attribute>
</xsl:if>
-<xsl:choose>
-<xsl:when test="$pos ='right'">
-<xsl:attribute name="id">
<xsl:value-of select="'rightFlowGraphic'"/>
</xsl:attribute>
</xsl:when>
-<xsl:when test="$pos ='left'">
-<xsl:attribute name="id">
<xsl:value-of select="'leftFlowGraphic'"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>
</xsl:element>
</xsl:template>
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<!--
      Emphasized text.
      
      The span class is the degree prefixed to the "Emph" string. So 
      
         <t:emph degree="weak">text</t:emph>
      
      would get translated to

         <span class="weakEmph">text</span>
   
-->
-<xsl:template match="t:emph" mode="inline-text">
-<xsl:choose>
-<xsl:when test="@degree">
-<xsl:element name="span">
-<xsl:attribute name="class">
<xsl:value-of select="concat( @degree, 'Emph')"/>
</xsl:attribute>
<xsl:apply-templates mode="inline-text"/>
</xsl:element>
</xsl:when>
-<xsl:otherwise>
-<xsl:element name="span">
-<xsl:attribute name="class">
<xsl:value-of select="'normalEmph'"/>
</xsl:attribute>
<xsl:apply-templates mode="inline-text"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
-<!--
 
      This needs expanding as necesary
   
-->
-<xsl:template match="t:note" mode="inline-text">
-<xsl:choose>
-<xsl:when test="name( //t:note/parent::* ) = 't:p'">
-<xsl:choose>
-<xsl:when test="@type='warning'">
-<i>
<xsl:apply-templates mode="inline-text"/>
</i>
</xsl:when>
</xsl:choose>
</xsl:when>
-<xsl:otherwise>
-<xsl:choose>
-<xsl:when test="@type='warning'">
-<xsl:element name="div">
<xsl:attribute name="class">warningTitle</xsl:attribute>
<xsl:text>Warning</xsl:text>
</xsl:element>
-<xsl:element name="div">
<xsl:attribute name="class">warningNote</xsl:attribute>
<xsl:apply-templates mode="inline-text"/>
</xsl:element>
</xsl:when>
-<xsl:when test="@type='note'">
-<xsl:element name="div">
<xsl:attribute name="class">noteTitle</xsl:attribute>
<xsl:text>Note</xsl:text>
</xsl:element>
-<xsl:element name="div">
<xsl:attribute name="class">noteNote</xsl:attribute>
<xsl:apply-templates mode="inline-text"/>
</xsl:element>
</xsl:when>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 
-->
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 
-->
-<xsl:template match="form:form" mode="inline-text">
-<xsl:element name="form">
<xsl:attribute name="method">post</xsl:attribute>
-<xsl:attribute name="action">
<xsl:value-of select="normalize-space(form:start/@url)"/>
</xsl:attribute>
-<xsl:element name="div">
<xsl:attribute name="class">normalPara</xsl:attribute>
-<xsl:for-each select="form:field">
<xsl:call-template name="outputField"/>
</xsl:for-each>
</xsl:element>
-<xsl:element name="input">
<xsl:attribute name="type">submit</xsl:attribute>
-<xsl:attribute name="value">
<xsl:value-of select="form:start"/>
</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:template>
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 
-->
-<!--
 Output individual fields of the form 
-->
-<xsl:template name="outputField" mode="inline-text">
<xsl:value-of select="."/>
:
-<xsl:element name="input">
-<xsl:attribute name="name">
<xsl:value-of select="@name"/>
</xsl:attribute>
-<xsl:attribute name="type">
<xsl:value-of select="@type"/>
</xsl:attribute>
</xsl:element>
<xsl:element name="br"/>
</xsl:template>
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 
-->
-<!--
 Ignore all index markers 
-->
<xsl:template match="t:index" mode="inline-text"/>
-<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 
-->
-<!--
 
		Soak up any remaining elements not processed by the above
	
-->
-<xsl:template match="node()|@*" priority="-1" mode="inline-text">
-<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>