Skip to content Skip to sidebar Skip to footer

Undefined: Undefined Error When Calling Xsltprocessor.prototype.importstylesheet

I want to prettify some XML, and I found following code (in this answer, JSFiddle). I modified it like this: const xsltDoc = new DOMParser().parseFromString([ // describes how

Solution 1:

In terms of XSLT you need a version attribute on the root element of the stylesheet so try <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">. This seems to fix the error on the importStylesheet call, see https://jsfiddle.net/sgeryvyu/361/.

On the other hand, Firefox/Mozilla's XSLT processor is known to do a tree to tree transformation so with transformToDocument and Mozilla you won't get any serialization options of xsl:output applied, meaning that attempt to push your DOM tree through an XSLT simply gives you another DOM tree without the wanted indentation.

Post a Comment for "Undefined: Undefined Error When Calling Xsltprocessor.prototype.importstylesheet"