This post is not yet over at tumblr! But it will be soon.
Sliced Software
June 05
JSTL: Mixing XML Tags with Core Tags
As an extension to my previous post on parsing XML documents with JSTL, some may be interested in mixing core tags with XML tags for greater flow control. For example, I wanted to pass a parameter to my JSP that was parsing and displaying my XML based change-log to control how much of the change-log was actually being displayed to the user. Because I am displaying these changes after an upgrade, it isn't necessary for the user to see changes that were for versions older than the upgrade-from version (ie: if they were upgrading from version 0.9 to 1.0, changes for version 0.9.1, 0.9.2 and 1.0 should be displayed but not 0.8 and 0.7.5).
Unfortunately, the JSTL XML tags do not, to my knowledge, allow expressions mixed with xpath syntax. For example, I could not do something like:
<x:if select="@version > param.version"> ... </x:if>@version attribute and then using the core JSTL tags, like so:<c:set var="version"><x:out select="@version"/></c:set>
<c:if test="${version > param.version}"> ... </c:if>

