Search code examples
javaxmlxslt

Error: The processing instruction target matching "[xX][mM][lL]" is not allowed


This error,

The processing instruction target matching "[xX][mM][lL]" is not allowed

occurs whenever I run an XSLT page that begins as follows:

<?xml version="1.0" encoding="windows-1256"?> 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:include href="../header.xsl"/>
  <xsl:template match="/">
    <xsl:call-template name="pstyle"/>
    <xsl:call-template name="Validation"/>
    <xsl:variable name="strLang">
      <xsl:value-of select="//lang"/>
    </xsl:variable>
    <!-- ////////////// Page Title ///////////// -->
    <title>
        <xsl:value-of select="//ListStudentFinishedExam.Title"/>
    </title>

Note: I removed any leading spaces before the first line, but the error still occurs!


Solution

  • Debug your XML file. Either there is space or added extra or fewer tags.

    For better understanding build the project through the command line. Windows: gradlew build

    In my case, AndroidManifest.xml has a blank space at the very first line

    <Empty Row> // This Creates the issue 
    <?xml version="1.0" encoding="utf-8"?>