[Home] [By Thread] [By Date] [Recent Entries]
If you want to use xsl:analyze-string with XSLT 2.0 (or 3.0), you can
put the regex in a variable, like so:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0"> <xsl:variable name="regex" as="xs:string" select="'\{([^}]+)\}'"/> <xsl:template match="input">
<xsl:copy>
<xsl:analyze-string select="." regex="{$regex}">
<xsl:matching-substring>
<ph>
<xsl:value-of select="regex-group(1)"/>
</ph>
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:value-of select="."/>
</xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:copy>
</xsl:template></xsl:stylesheet> (Assuming the input string is wrapped in an <input> element, and replacing Martin's '\p{L)+' with '[^}]+' that matches anything that is not a closing brace, just for variation and for illustrating additional brace/regex complexity.) Or you can put the regex immediately in the regex attribute, but then you need to duplicate each brace because the processor otherwise attempts to evaluate AVTs within: <xsl:analyze-string select="." regex="\{{([^}}]+)\}}"> Gerrit On 10.06.2019 18:48, Martin Honnen martin.honnen@xxxxxx wrote: On 10.06.2019 18:30, Don Smith dsmith_lockesmith@xxxxxxxxx wrote:Hello,
Registergericht / Commercial Register: Amtsgericht Leipzig Registernummer / Registration Number: HRB 24930 GeschC$ftsfC<hrer / Managing Directors: Gerrit Imsieke, Svea Jelonek, Thomas Schmidt
|

Cart



