0
votes

I am getting below error while using character-map feature of XSLT 2.0 in my code.

The element 'stylesheet' in namespace 'http://www.w3.org/1999/XSL/Transform' has invalid child element 'character-map' in namespace 'http://www.w3.org/1999/XSL/Transform'

Here is my XSLT declaration

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:character-map name="a">
        <xsl:output-character character="'" string="&amp;apos;"/>

</xsl:character-map>
  <xsl:output indent="yes" use-character-maps="a"/>

Please help on how to use character-map in XSLT.

1
It looks to me as if you aren't using an XSLT 2.0 processor. What processor are you trying to use, and how are you invoking it? - Michael Kay
Please provide name of the library you use and minimal reproducible example of code used to invoke transform. Please note that there is no XSLT 2.0 processor in .Net Framework. - Alexei Levenkov
I am using .Net Framework 4.0. I am not using any third party processor. - Mahesh Chitroda
You're using xsl:character-map correctly, but like the others mentioned .net doesn't support XSLT 2.0. This question may help with options: stackoverflow.com/questions/1525299/xpath-and-xslt-2-0-for-net - Daniel Haley

1 Answers

0
votes

As mentioned in the comments, the answer to your question is that you need to use an XSLT 2.0 processor since your stylesheet uses XSLT 2.0 constructs. The Microsoft processor in .NET is an XSLT 1.0 processor. Various third-party XSLT 2.0 processors are available for the .NET platform.