0

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.

  • 3
    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 Jun 03 '16 at 14:08
  • Please provide name of the library you use and [MCVE] of code used to invoke transform. Please note that there is no XSLT 2.0 processor in .Net Framework. – Alexei Levenkov Jun 03 '16 at 14:11
  • I am using .Net Framework 4.0. I am not using any third party processor. – Mahesh Chitroda Jun 03 '16 at 15:01
  • 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: http://stackoverflow.com/questions/1525299/xpath-and-xslt-2-0-for-net – Daniel Haley Jun 03 '16 at 15:43

1 Answers1

0

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.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164