For Programmers: Free Programming Magazines  


Home > Archive > Java Beans > March 2004 > JSTL XML Transform losing tags









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author JSTL XML Transform losing tags
Alasdair Dougall

2004-03-31, 7:46 am

Hi,

My problem is to do with JSTL, transform tag and the resulting text
returned in an x:out call.

Missing are tags, like <meta keywords="recipes, recipe, australian....
which are present in the transformed document (see below.)

The JSP:

<%@ page contentType="text/html; charset=iso-8859-1" language="java"
errorPage="" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %>
<!-- Import the file. In the future, check the cache first. -->
<c:choose>
<c:when test="${param.pageid} == ''">
<jsp:forward page="/recipeindex.jsp" />
</c:when>
<c:otherwise>
<c:import url="${param.pageid}" var="xml"/>
<c:import url="/schema/recipe-jstl.xsl" var="xsl"/>
<x:transform xml="${xml}" xslt="${xsl}" var="doc" />
</c:otherwise>
</c:choose>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<x:out select="$doc/recipe/headcontent" escapeXml="false" />
</head>
<body>
<h1><x:out select="$doc/recipe/recipetitle" escapeXml="false"/></h1>
<x:out select="$doc/recipe/description" escapeXml="false"/>
</body>
</html>

The result of the transform is:


------------------------------------------------------------
<?xml version="1.0" encoding="ISO8859_1"?>
<recipe>
<headcontent>
<title>Kangaroo Surf and Turf Kebabs recipes australian</title>
<meta keywords="recipes, recipe, australian, australia,
kangaroo, seafood, surf and turf, prawns, salad"/>
</headcontent>
<recipetitle>
<h1>
<span class="title">Kangaroo Surf and Turf Kebabs</span>
</h1>
</recipetitle>
....
</recipe>
------------------------------------------------------------

and the output of the jsp is

<!-- Import the file. In the future, check the cache first. -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
Pear and Almond Tart Recipe Cake
</head>
<body>
<h1>Pear and Almond Tart</h1>

</body>
</html>
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com