File tree Expand file tree Collapse file tree 3 files changed +50
-1
lines changed Expand file tree Collapse file tree 3 files changed +50
-1
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,9 @@ export class LocationExpr extends Expression {
6969 start = context . root ;
7070 } else {
7171 start = context . nodeList [ context . position ] ;
72+ if ( start . nodeName === '#document' ) {
73+ start = start . childNodes [ 0 ] ;
74+ }
7275 }
7376
7477 const nodes = [ ] ;
Original file line number Diff line number Diff line change @@ -330,7 +330,6 @@ export class Xslt {
330330 // XPath doesn't have an axis to select "self and siblings", and
331331 // the default axis is "child", so to select the correct children
332332 // in relative path, we force a 'self-and-siblings' axis.
333- // nodes = this.xsltMatch(match, context, context.inApplyTemplates ? 'self-and-siblings' : undefined);
334333 nodes = this . xsltMatch ( match , context , 'self-and-siblings' ) ;
335334 if ( nodes . length > 0 ) {
336335 if ( ! context . inApplyTemplates ) {
Original file line number Diff line number Diff line change 1+ /* eslint-disable no-undef */
2+ import assert from 'assert' ;
3+
4+ import React from 'react' ;
5+ import { dom } from 'isomorphic-jsx' ;
6+ import { Xslt } from '../src/xslt' ;
7+ import { xmlParse } from '../src/dom' ;
8+
9+ // Just touching the `dom`, otherwise Babel prunes the import.
10+ console . log ( dom ) ;
11+ describe ( 'LMHT' , ( ) => {
12+ it ( 'Trivial' , ( ) => {
13+ const xmlString = (
14+ < lmht >
15+ < cabeca >
16+ < titulo > Teste</ titulo >
17+ </ cabeca >
18+ < corpo >
19+ Teste
20+ </ corpo >
21+ </ lmht >
22+ ) ;
23+
24+ const xsltString =
25+ '<?xml version="1.0"?>' +
26+ (
27+ < xsl :stylesheet version = "1.0" xmlns :xsl = "http://www.w3.org/1999/XSL/Transform" xmlns :xs = "http://www.w3.org/2001/XMLSchema" >
28+ < xsl :template match = "lmht" >
29+ < html >
30+ Teste
31+ </ html >
32+ </ xsl :template >
33+ </ xsl :stylesheet >
34+ ) ;
35+
36+ const expectedOutString = (
37+ < html > Teste</ html >
38+ ) ;
39+
40+ const xsltClass = new Xslt ( ) ;
41+ const xml = xmlParse ( xmlString ) ;
42+ const xslt = xmlParse ( xsltString ) ;
43+ const outXmlString = xsltClass . xsltProcess ( xml , xslt ) ;
44+
45+ assert . equal ( outXmlString , expectedOutString ) ;
46+ } ) ;
47+ } ) ;
You can’t perform that action at this time.
0 commit comments