left up right
XSLT path Recogniser
<xsl:template match="decode">

<output>
<xsl:copy-of select="@*"/>  Copies the attributes on the path
<xsl:call-template name="one">  Calls the first state
 <xsl:with-param name="str" select="@d"/>  String initially is the d attribute
 <xsl:with-param name="max" select="@num"/>  max set to numbers required
 <xsl:with-param name="pos" select="1"/>     Enter state 1 looking for number 1
 <xsl:with-param name="sofar" select="''"/>  Not recognised anything yet!
</xsl:call-template>
</output>

</xsl:template>