I need to make multiple replacements.
<!-- simple replacements to meaningful entities or Unicode -->
<replacements>
<replace><<</replace><with>“</with>
<replace>>></replace><with>”</with>
<replace><;</replace><with>‘</with>
<replace>></replace><with>’</with>
<!-- need to be able to mark text for omission in a way that we can
roundtrip it
replacing the text with <omit>|fn</omit> is option that would work -->
<omit>|fn</omit>
</replacements>
I was considering this external XML that the user can easily edit as the
source of the changes.
I am using Saxon 9 ... XSLT 2.0 (Thanks for the elegant tools.)
I found the acronym example and started changing it to
replacements/replace but am lost now as to how to proceed.
<xsl:variable name="replacements" as="element(replace)+"
select="document('../xml/replacements.xml')/replacements/replace" />
<xsl:variable name="replace-regex" as="xs:string"
select="string-join($replacements/@replace, '|')" />
<xsl:analyze-string select="$text" regex="{$replace-regex}">
<xsl:matching-substring>
<xsl:variable name="replace" as="xs:string" select="." />
<replace title="{$replacements[(_at_)replace = $replace]}">
<xsl:value-of select="$replace" />
</replace>
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:value-of select="." />
</xsl:non-matching-substring>
</xsl:analyze-string>
Thanks for your help.
Jim Albright
704 843-0582
JAARS, Speeding Bible Translation
Wycliffe, Partners in Bible Translation
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--