Reputation: 31
I am writing an XSLT transformation in which I wish to use the matches function to do a regex match and replace.
Visual Studio 2008 that 'matches ()' is an unknown XSLT function.
<xsl:when test="matches(normalize-space(.),'^([(]I[)])(.+)')">
<xsl:analyze-string select="normalize-space(.)" regex="^^([(]I[)])(.+)"
flags="x">
<xsl:matching-substring>
<xsl:variable name="paraNumber">
<xsl:value-of select="regex-group(1)"/>
</xsl:variable>
<xsl:variable name="text">
<xsl:value-of select="regex-group(2)"/>
</xsl:variable>
<span class="upper-I-double-bracket">
<xsl:value-of select="$paraNumber"/>
</span>
<xsl:value-of select="$text"/>
</xsl:matching-substring>
</xsl:analyze-string>
</xsl:when>
Upvotes: 1
Views: 1928
Reputation: 243619
Visual studio (all currently known versions) uses the .NET XSLT 1.0 processor XslCompiledTransform or (versions before VS2005) the older XslTransform. These are XSLT 1.0 processors.
The xsl:analyze-string
is only supported by XSLT 2.0+ and this explains the error message you get.
If you need to use an XSLT 2.0 processor in a .NET environment you can choose either one of the Saxon.NET or XQSharp XSLT 2.0 processors that are developed especially for .NET.
Upvotes: 2