1
2
3
4
5 package com.jcabi.xml;
6
7 import com.jcabi.matchers.XhtmlMatchers;
8 import java.util.Arrays;
9 import org.apache.commons.lang3.StringUtils;
10 import org.hamcrest.MatcherAssert;
11 import org.junit.jupiter.api.Test;
12
13
14
15
16
17
18 final class XSLChainTest {
19
20 @Test
21 void makesXslTransformations() {
22 final XSL first = new XSLDocument(
23 StringUtils.join(
24 "<xsl:stylesheet",
25 " xmlns:xsl='http://www.w3.org/1999/XSL/Transform'",
26 " version='2.0'>",
27 "<xsl:template match='/'><done/>",
28 "</xsl:template></xsl:stylesheet>"
29 )
30 );
31 final XSL second = new XSLDocument(
32 StringUtils.join(
33 "<xsl:stylesheet ",
34 " xmlns:xsl='http://www.w3.org/1999/XSL/Transform' ",
35 " version='2.0' >",
36 "<xsl:template match='/done'><twice/>",
37 "</xsl:template> </xsl:stylesheet>"
38 )
39 );
40 MatcherAssert.assertThat(
41 "XPath result node does not match with expected, but it should",
42 new XSLChain(Arrays.asList(first, second)).transform(
43 new XMLDocument("<a/>")
44 ),
45 XhtmlMatchers.hasXPath("/twice")
46 );
47 }
48
49 }