Solved, thank you all!
For the benefit of someone searching the forum:
Useful as part of solution for up-marking (because more than one
pattern adds another contextual dimension, thereby avoiding false
true's). For similar problem and suggestions see
http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/201101/msg00113.html
Given:
The sound a dog makes is woof and the sound a cat makes is bark.
regex="(the sound)(.*)(makes)"
gives you "a dog" and "a cat" as regex-group(2)
-- Thanks David
Using this:
<xsl:variable name="regex" as="xs:string">(sound)(.*?)(makes)</xsl:variable>
<xsl:analyze-string select="." regex="{$regex}">
<xsl:matching-substring>
<xsl:value-of select="regex-group(1)"/>
<wrapped><xsl:value-of select="regex-group(2)"/></wrapped>
<xsl:value-of select="regex-group(3)"/>
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:value-of select="."/>
</xsl:non-matching-substring>
</xsl:analyze-string>
Gives you:
The sound<wrapped> a dog </wrapped>makes is woof and the
sound<wrapped> a cat </wrapped>makes is bark.
-- Thanks Andrew and David
Why is this useful?
Because now you can change:
CAPTAIN: Was that the sound of cannon fire?
Into:
<actor name="CAPTAIN">
<dialogue-line>
Was that the sound of cannon fire?
<dialogue-line>
</actor>
... with minimum guessing
--~------------------------------------------------------------------
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>
--~--