ORA-39212 ORA-39213 Metadata processing is not available

While running import datapump following errors are seen,

[mpoojari@romford ]$ impdp parfile=imp.par

Import: Release - Production on Tue Jun 27 13:02:53 2017

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 12c Enterprise Edition Release - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Advanced Analytics
and Real Application Testing options
ORA-39006: internal error
ORA-39213: Metadata processing is not available

DataPump export uses DBMS_METADATA_UTIL package but this package does not successfully run. Executing DBMS_METADATA.GET_DDL throws the below error message,

SQL> select dbms_metadata.get_ddl('TABLESPACE','MY_TABLES') from dual;
ORA-39212: installation error: XSL stylesheets not loaded correctly
ORA-06512: at "SYS.DBMS_METADATA", line 6069
ORA-06512: at "SYS.DBMS_METADATA", line 8666
ORA-06512: at line 1


The XSL stylesheets have not been (correctly) loaded into the database.

SQL> exec dbms_metadata_util.load_stylesheets;

PL/SQL procedure successfully completed.

In some cases, you may also need to check JAVA and XML installed on the database.