I have a xml with format say
<x>
<y>
<z Name="z"> File Explorer </z>
</y>
</x>
I want to write a freemarker template to retrieve the content "File Explorer". I have written java code to transform xml to html. input xml is given xml.
Configuration configuration = new Configuration(Configuration.VERSION_2_3_23);
configuration.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
configuration.setDefaultEncoding("UTF-8");
InputSource inputSource = new InputSource( new StringReader(xml.asXML()));
root.put("doc", freemarker.ext.dom.NodeModel.parse(inputSource));
result = new StringWriter();
template.process(root, result);
I tried freemarker template with xpath
<span>${doc["x/y/z[@Name='z']"/]}</span>
But this on transforming displays
${doc["x/y/z[@Name='z']"/]}
instead of
File Explorer