@@ -28,61 +28,81 @@ const xmlString = (
2828) ;
2929
3030describe ( 'xslt' , ( ) => {
31- it ( 'handles for-each sort' , ( ) => {
32- const xsltForEachSort = (
33- < xsl :stylesheet >
34- < xsl :template match = "/" >
35- < xsl :for-each select = "//item" >
36- < xsl :sort select = "@pos" />
37- < xsl :value-of select = "." />
38- </ xsl :for-each >
39- </ xsl :template >
40- </ xsl :stylesheet >
41- ) ;
42-
43- const xsltClass = new Xslt ( ) ;
44- const xml = xmlParse ( xmlString ) ;
45- const xslt = xmlParse ( xsltForEachSort ) ;
46- const html = xsltClass . xsltProcess ( xml , xslt ) ;
47- assert . equal ( html , 'CAB' ) ;
48- } ) ;
49-
50- it ( 'handles for-each sort ascending' , ( ) => {
51- const xsltForEachSortAscending = (
52- < xsl :stylesheet >
53- < xsl :template match = "/" >
54- < xsl :for-each select = "//item" >
55- < xsl :sort select = "." order = "ascending" />
56- < xsl :value-of select = "." />
57- </ xsl :for-each >
58- </ xsl :template >
59- </ xsl :stylesheet >
60- ) ;
61-
62- const xsltClass = new Xslt ( ) ;
63- const xml = xmlParse ( xmlString ) ;
64- const xslt = xmlParse ( xsltForEachSortAscending ) ;
65- const html = xsltClass . xsltProcess ( xml , xslt ) ;
66- assert . equal ( html , 'ABC' ) ;
31+ describe ( 'xsl:for-each' , ( ) => {
32+ it ( 'handles for-each sort' , ( ) => {
33+ const xsltForEachSort = (
34+ < xsl :stylesheet >
35+ < xsl :template match = "/" >
36+ < xsl :for-each select = "//item" >
37+ < xsl :sort select = "@pos" />
38+ < xsl :value-of select = "." />
39+ </ xsl :for-each >
40+ </ xsl :template >
41+ </ xsl :stylesheet >
42+ ) ;
43+
44+ const xsltClass = new Xslt ( ) ;
45+ const xml = xmlParse ( xmlString ) ;
46+ const xslt = xmlParse ( xsltForEachSort ) ;
47+ const html = xsltClass . xsltProcess ( xml , xslt ) ;
48+ assert . equal ( html , 'CAB' ) ;
49+ } ) ;
50+
51+ it ( 'handles for-each sort ascending' , ( ) => {
52+ const xsltForEachSortAscending = (
53+ < xsl :stylesheet >
54+ < xsl :template match = "/" >
55+ < xsl :for-each select = "//item" >
56+ < xsl :sort select = "." order = "ascending" />
57+ < xsl :value-of select = "." />
58+ </ xsl :for-each >
59+ </ xsl :template >
60+ </ xsl :stylesheet >
61+ ) ;
62+
63+ const xsltClass = new Xslt ( ) ;
64+ const xml = xmlParse ( xmlString ) ;
65+ const xslt = xmlParse ( xsltForEachSortAscending ) ;
66+ const html = xsltClass . xsltProcess ( xml , xslt ) ;
67+ assert . equal ( html , 'ABC' ) ;
68+ } ) ;
69+
70+ it ( 'handles for-each sort descending' , ( ) => {
71+ const xsltForEachSortDescending = (
72+ < xsl :stylesheet >
73+ < xsl :template match = "/" >
74+ < xsl :for-each select = "//item" >
75+ < xsl :sort select = "." order = "descending" />
76+ < xsl :value-of select = "." />
77+ </ xsl :for-each >
78+ </ xsl :template >
79+ </ xsl :stylesheet >
80+ ) ;
81+
82+ const xsltClass = new Xslt ( ) ;
83+ const xml = xmlParse ( xmlString ) ;
84+ const xslt = xmlParse ( xsltForEachSortDescending ) ;
85+ const html = xsltClass . xsltProcess ( xml , xslt ) ;
86+ assert . equal ( html , 'CBA' ) ;
87+ } ) ;
6788 } ) ;
6889
69- it ( 'handles for-each sort descending' , ( ) => {
70- const xsltForEachSortDescending = (
71- < xsl :stylesheet >
90+ describe ( 'xsl:text' , ( ) => {
91+ it ( 'disable-output-escaping' , ( ) => {
92+ const xml = < anything > </ anything > ;
93+ const xslt = < xsl :stylesheet version = "1.0" xmlns :xsl = "http://www.w3.org/1999/XSL/Transform" >
94+ < xsl :output method = "html" indent = "yes" />
7295 < xsl :template match = "/" >
73- < xsl :for-each select = "//item" >
74- < xsl :sort select = "." order = "descending" />
75- < xsl :value-of select = "." />
76- </ xsl :for-each >
96+ < xsl :text disable-output-escaping = "yes" > <!DOCTYPE html></ xsl :text >
7797 </ xsl :template >
78- </ xsl :stylesheet >
79- ) ;
80-
81- const xsltClass = new Xslt ( ) ;
82- const xml = xmlParse ( xmlString ) ;
83- const xslt = xmlParse ( xsltForEachSortDescending ) ;
84- const html = xsltClass . xsltProcess ( xml , xslt ) ;
85- assert . equal ( html , 'CBA' ) ;
98+ </ xsl :stylesheet > ;
99+
100+ const xsltClass = new Xslt ( ) ;
101+ const parsedXml = xmlParse ( xml ) ;
102+ const parsedXslt = xmlParse ( xslt ) ;
103+ const html = xsltClass . xsltProcess ( parsedXml , parsedXslt ) ;
104+ assert . equal ( html , '<!DOCTYPE html>' ) ;
105+ } ) ;
86106 } ) ;
87107
88108 it ( 'applies templates' , ( ) => {
0 commit comments