transform.jsp
<%@ page session="false" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<x:transform xslt="question.xsl">
<c:import url="questions.jspx" />
</x:transform>
I've got this error:
javax.xml.transform.TransformerException:
org.xml.sax.SAXParseException: Content is not allowed in prolog."
The solution is to specify the xsl-file in a variable:
<%@ page session="false" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<<@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<c:import url="question.xsl" var="xslfile"/>
<x:transform xslt="${xslfile}">
<c:import url="questions.jspx" />
</x:transform>
Geen opmerkingen:
Een reactie posten