Skip to content

Commit

Permalink
#735: reproduced
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jun 25, 2017
1 parent 90807d3 commit ad1ee67
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/test/java/org/takes/rs/RsXsltTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,26 @@ public void resolvesInClasspath() throws IOException {
);
}

/**
* RsXSLT can load XSL stylesheets from the web.
* @throws IOException If some problem inside
*/
@Test
public void loadsExternalImports() throws IOException {
final String xml = Joiner.on(' ').join(
"<?xml-stylesheet",
" href='/org/takes/rs/stylesheet-with-include.xsl'",
" type='text/xsl'?>",
"<page sla='0.324'/>"
);
MatcherAssert.assertThat(
IOUtils.toString(
new RsXslt(
new RsText(xml)
).body()
),
XhtmlMatchers.hasXPath("//xhtml:p[.='\u0443']")
);
}

}
11 changes: 11 additions & 0 deletions src/test/resources/org/takes/rs/stylesheet-with-include.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<stylesheet xmlns='http://www.w3.org/1999/XSL/Transform'
xmlns:x='http://www.w3.org/1999/xhtml' version='1.0'>
<include href='http://raw.githubusercontent.com/yegor256/takes/master/src/main/resources/org/takes/rs/xe/sla.xsl'/>
<template match='/page'>
<x:html>
<call-template name='takes_sla'>
<with-param name='sla' select='@sla'/>
</call-template>",
</x:html>
</template>
</stylesheet>

0 comments on commit ad1ee67

Please sign in to comment.