<?xml version="1.0" encoding="utf-8"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">

  <!-- blogTEI - Francois Lachance - TEIblog-->

 <!-- this is a template to include in a XSLT file -->
  <!-- it is desiged to toggle between word order options  -->
  <!-- it targets markup of w elements -->
  <!-- with prev and next attributes whose values guide output -->

  <!-- see TEI Guidelines for more on the content model -->
  <!-- see XSLT Recomendation for more on xsl:choose -->
  <!-- see XSLT Recomendation for more on modes and templates -->

  
  
  <xsl:template match="title/w">
    
  <xsl:choose>
      
  <xsl:when test="@next='MetaM'">
      <xsl:value-of select="following-sibling::w[@prev='HyperM']"/>
  </xsl:when>
 
  <xsl:when test="@prev='HyperM'">
      <xsl:value-of select="preceding-sibling::w[@next='MetaM']"/>
  </xsl:when>

  <xsl:otherwise>
    <xsl:apply-templates/>
  </xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:transform>

