Xsl function to testing if text only contains footnote marks
<footnotes>
<footnote ref="\*"/>
<footnote ref="\+"/>
<footnote ref="†"/>
<footnote ref="\([a-z]\)"/>
<footnote ref="\([1-9]\)"/>
</footnotes>
I then concat the refs together with a | and do a replace on the string value. If nothing is left then it is a footnote ref.
<!-- Reads all possible footnote ref marks from a footnotes.xml file and if pText only contains footnote marks returns true otherwise false -->
<xsl:function name="txt:IsFootnoteRef" as="xs:boolean">
<xsl:param name="pText" as="xs:string"/>
<xsl:variable name="vFootnotes" select=" document('./footnotes.xml')/footnotes/footnote"/>
<xsl:choose>
<xsl:when test="not($vFootnotes)">
<xsl:value-of select="false()"/>
</xsl:when>
<xsl:when test="not($pText)">
<xsl:value-of select="false()"/>
</xsl:when>
<xsl:when test="normalize-space($pText) = '' ">
<xsl:value-of select="false()"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="vFootnoteRef">
<xsl:value-of select="$vFootnotes/@ref" separator="|"/>
</xsl:variable>
<xsl:choose>
<xsl:when test=" normalize-space(replace($pText, $vFootnoteRef , '' , 'i')) = '' ">
<xsl:value-of select="true()"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="false()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:function>

