<?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:call-template name="prev"/>
    <xsl:call-template name="next"/>

  </xsl:template>

  <xsl:template name="prev">
  <xsl:if test="@next='MetaM'">
      <xsl:value-of select="following-sibling::w[@prev='HyperM']"/>
  </xsl:if>
  </xsl:template>

  <xsl:template name="next">
  <xsl:if test="@prev='HyperM'">
      <xsl:value-of select="preceding-sibling::w[@next='MetaM']"/>
  </xsl:if>
  </xsl:template>
</xsl:transform>

