<?xml version="1.0" encoding="UTF-8"?><?xar XSLT?>
<!-- 
 ============================================================== 
 DOCUMENTATION
 ============================================================== 
  

-->  


<xsl:stylesheet version="1.0" 
   xmlns:sch="http://purl.oclc.org/dsdl/schematron" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  >

<!-- 
 ============================================================== 
 DECLARATIONS
 ============================================================== 
-->  
<xsl:output method="xml" omit-xml-declaration="no" standalone="yes" />

<!-- 
 ============================================================== 
 SCHEMA ELEMENT
 ============================================================== 
-->  
<xsl:template match="sch:schema">
   <xsl:apply-templates />
</xsl:template>

<!-- INCLUDE --> 
<xsl:template match="sch:include[not(normalize-space(@href))]" priority="1">
		<xsl:message terminate="yes">Schema error: Empty href= attribute for include directive.</xsl:message>
</xsl:template>

<!-- Extend the URI syntax to allow # refererences -->
<xsl:template match="sch:include">
    <xsl:variable name="document-uri" select="substring-before(concat(@href,'#'), '#')"/>
    <xsl:variable name="fragment-id" select="substring-after(@href, '#')"/>
       
    <xsl:choose> 
       <xsl:when test="$fragment-id">
            <xsl:apply-templates select="document( $document-uri,/ )//sch:*[@id= $fragment-id ]"/>
		</xsl:when>
		<xsl:otherwise>
       		<xsl:apply-templates select="document( $document-uri,/ )/*"/>
       	</xsl:otherwise>
	</xsl:choose>
</xsl:template>


<!-- 
 ============================================================== 
 OTHER SCHEMA ELEMENTS
 ============================================================== 
-->  
<!-- ACTIVE -->
<xsl:template match="sch:active">
  <xsl:apply-templates />
</xsl:template>

<!-- ASSERT and REPORT-->
<xsl:template match="sch:assert">
  <xsl:apply-templates />
</xsl:template>

<xsl:template match="sch:report">
  <xsl:apply-templates />
</xsl:template>

<!-- DIAGNOSTIC -->
<xsl:template match="sch:diagnostic">
   <xsl:apply-templates />
</xsl:template>

<!-- DIAGNOSTICS -->
<xsl:template match="sch:diagnostics">
   <xsl:apply-templates />
</xsl:template>

<!-- DIR -->
<xsl:template match="sch:dir">
   <xsl:apply-templates />
</xsl:template>

<!-- EMPH -->
<xsl:template match="sch:emph">
   <xsl:apply-templates />
</xsl:template>

<!-- EXTENDS -->
<xsl:template match="sch:extends">
   <xsl:apply-templates />
</xsl:template>

<!-- XSL:KEY -->
<xsl:template match="xsl:key">
   <xsl:apply-templates />
</xsl:template>

<!-- LET -->
<xsl:template match="sch:let">
   <xsl:apply-templates />
</xsl:template>

<!-- NAME -->
<xsl:template match="sch:name">
   <xsl:apply-templates />
</xsl:template>

<!-- NS -->
<xsl:template match="sch:ns">
   <xsl:apply-templates />
</xsl:template>

<!-- P -->
<xsl:template match="sch:p[@class]"  priority="1">
   <!-- common case is that class = ol or ul need to become list items -->
   <xsl:choose>
   		<xsl:when test="@class='ul'">
   			<xsl:if test="not(preceding-sibling::sch:p[@class='ul'])">
   				<xsl:text disable-output-escaping="yes">&lt;ul&gt;</xsl:text>
   			</xsl:if>
   			<li><xsl:apply-templates /></li>  			
   			<xsl:if test="not(following-sibling::sch:p[@class='ul'])">
   				<xsl:text disable-output-escaping="yes">&lt;/ul&gt;</xsl:text>
   			</xsl:if>
   		</xsl:when>
   		
   		<xsl:when test="@class='ol'">
   			<xsl:if test="not(preceding-sibling::sch:p[@class='ol'])">
   				<xsl:text disable-output-escaping="yes">&lt;ol&gt;</xsl:text>
   			</xsl:if>
   			<li><xsl:apply-templates /></li>
   			<xsl:if test="not(following-sibling::sch:p[@class='ol'])">
   				<xsl:text disable-output-escaping="yes">&lt;/ol&gt;</xsl:text>
   			</xsl:if>
   		</xsl:when>
   
   
   		<xsl:otherwise>
   			<xsl:element name="{@class}"><xsl:apply-templates /></xsl:element>
   		</xsl:otherwise>
   	</xsl:choose>	
</xsl:template>

<xsl:template match="sch:p">
   <p><xsl:apply-templates /></p>
</xsl:template>
 

<!-- PATTERN -->

<xsl:template match="sch:pattern[@abstract='true']" priority="1">
   <xsl:apply-templates />
</xsl:template>

<xsl:template match="sch:pattern[@is-a]" priority="1">
   <xsl:apply-templates />
</xsl:template>

<xsl:template match="sch:pattern">
   <xsl:apply-templates />
</xsl:template>

<!-- PHASE -->
<xsl:template match="sch:phase">
   <xsl:apply-templates />
</xsl:template>

<!-- RULE -->
<xsl:template match="sch:rule[@abstract='true]"  priority="1">
   		<xsl:apply-templates />
</xsl:template>

<xsl:template match="sch:rule">
   		<xsl:apply-templates />
  
</xsl:template>


<!-- SPAN -->
<xsl:template match="sch:span">
   <xsl:apply-templates />
</xsl:template>

<!-- TITLE -->
<xsl:template match="sch:title">
   <xsl:apply-templates />
</xsl:template>

<!-- VALUE-OF -->
<xsl:template match="sch:value-of">
   <xsl:apply-templates />
</xsl:template>
 

</xsl:stylesheet>
