<xsl:template match="w:fldSimple">
<xsl:variable name="rstyle">
<xsl:value-of select="w:r/w:rPr/w:rStyle/@w:val"/>
</xsl:variable>
<xsl:variable name="rends">
<r>fldSimple</r>
<xsl:if test="contains(@w:instr,'NOTEREF')">
<r>noteref</r>
</xsl:if>
<xsl:if test="contains(@w:instr,'MERGEFORMAT')">
<r>mergeformat</r>
</xsl:if>
<xsl:if test="contains(@w:instr,' \r')">
<r>instr_r</r>
</xsl:if>
<xsl:if test="contains(@w:instr,' \f')">
<r>instr_f</r>
</xsl:if>
<xsl:if test="contains(@w:instr,' \n')">
<r>instr_n</r>
</xsl:if>
</xsl:variable>
<!-- <xsl:message>rends=<xsl:copy-of select="$rends"/></xsl:message> -->
<xsl:choose>
<!-- cross ref -->
<!-- <w:fldSimple w:instr=" REF _Ref260736521 \r \h \* MERGEFORMAT "> -->
<xsl:when test="contains(@w:instr,'NOTEREF _Ref')">
<xsl:variable name="ref">
<xsl:value-of select="substring-before(substring-after(@w:instr,'_'),' ')"/>
</xsl:variable>
<ref>
<xsl:attribute name="rend">
<xsl:value-of select="string-join(($rends/tei:r),' ')"/>
</xsl:attribute>
<xsl:attribute name="target" select="concat('#',$ref)"/>
<xsl:if test="$rstyle!=''">
<xsl:attribute name="iso:class">
<xsl:value-of select="$rstyle"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</ref>
</xsl:when>
<xsl:when test="contains(@w:instr,'REF _Ref')">
<xsl:variable name="ref">
<xsl:value-of select="substring-before(substring-after(@w:instr,'_'),' ')"/>
</xsl:variable>
<ref>
<xsl:attribute name="rend">
<xsl:value-of select="string-join(($rends/tei:r),' ')"/>
</xsl:attribute>
<xsl:attribute name="target" select="concat('#',$ref)"/>
<xsl:if test="$rstyle!=''">
<xsl:attribute name="iso:class">
<xsl:value-of select="$rstyle"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</ref>
</xsl:when>
<xsl:when test="contains(@w:instr,'PAGE')">
<!-- Page number -->
<tei:dynamicContent type="pagenumber"/>
</xsl:when>
<xsl:when test="contains(@w:instr,'SEQ')"/>
<!-- not sure -->
<xsl:when test="contains(@w:instr,'INCLUDETEXT')"/>
<!-- from docm to docx conversion? -->
<xsl:when test="contains(@w:instr,'TEMPLATE')"/>
<!-- from docm to docx conversion? -->
<xsl:otherwise>
<xsl:message terminate="yes">fldSimple: unrecognized type
<xsl:value-of select="@w:instr"/>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template> |