[opencms-dev] Problems using JSTL and XSLT with page parameters
Laurent Gauthier
lgauthier at opnworks.com
Wed Sep 17 01:14:01 CEST 2003
All,
I would like to retrieve a page property and use it as inoput to a JSTL
tag for XML and XSLT processing.
This seems difficult since the only way I found to specify an OpenCMS
file to JSTL is using the following JSP directive.
<%@ cms file="resources/collectionDefinition.xml" %>
For example the following works but everything is "static". I would like
to use the xsltFilename in my XML tags.
Any example from someone smart?
Laurent
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
<html>
<head>
<title>XML Support -- Transform</title>
</head>
<body bgcolor="#FFFFFF">
<h3>Parse / Expr</h3>
// Set a JSTL variable from page property
<c:set var="xsltFilename">
<cms:property name="xslt" />
</c:set>
// Set variable to point to XML file in VFS
<c:set var="xmlPath">
<%@ cms file="resources/collectionDefinition.xml" %>
</c:set>
// Set variable to point to XSL file in VFS
<c:set var="xsltPath">
<%@ cms file="resources/dynprop2html.xsl" %>
</c:set>
// Import files into JSTL variables
<c:import var="xml" url="${xmlPath}"/>
<c:import var="xsl" url="${xsltPath}" />
// Transform file and output result using XML tag library for JSTL
<x:transform xml="${xml}" xslt="${xsl}" />
</body>
</html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20030917/9958bad3/attachment.htm>
More information about the opencms-dev
mailing list