+ <when test="not($start-node) or $separator-node[following-sibling::* or following-sibling::comment()]">
+ <variable name="bad-start-node" select="($preceding[self::text() and contains(., $start-sigil)])[last()]"/>
+ <variable name="bad-start-tokens-fragment">
+ <call-template name="LesML:split">
+ <with-param name="source" select="string($bad-start-node)"/>
+ <with-param name="separator" select="$start-sigil"/>
+ </call-template>
+ </variable>
+ <element name="span" namespace="&xhtml;">
+ <copy-of select="$bad-start-node/preceding-sibling::node()"/>
+ <for-each select="exsl:node-set($bad-start-tokens-fragment)/*">
+ <value-of select="."/>
+ <if test="position()!=last()">
+ <processing-instruction name="LesML-Token-Escape">
+ <value-of select="$start-sigil"/>
+ </processing-instruction>
+ </if>
+ </for-each>
+ <copy-of select="$bad-start-node/following-sibling::node()"/>
+ <value-of select="$end-sigil"/>
+ <value-of select="substring-after($end-node, $end-sigil)"/>
+ <copy-of select="$end-node/following-sibling::node()"/>
+ </element>
+ </when>
+ <when test="$separator-node">