I am using and XSL to transform a JSP into an HTML. While transforming I am linking a CSS. When the request has a character & to show in an input type="text" or in a textarea, as shown below, the browser shows a blank page.
How could I show that character on the web page?
The url is defined in the web.xml.
My JSP
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html; charset=ISO-8859-1"%>
<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x"%>
<c:import var="xslt" url="${initParam.URL_XSLT}" charEncoding="ISO-8859-1"/>
<x:transform xslt="${xslt}">
<MyTag>
<content>
<div class="">
<input type="text" name="aName" value="${requestScope.myString}"/>
<textarea name="aComment">${requestScope.myString2}</textarea>
</div>
</content>
</MyTag>
My XSL
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" omit-xml-declaration="yes" encoding="ISO-8859-1" indent="yes" />
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
<head>
<link type="text/css" rel="stylesheet" href="http://general.css"/>
...
</head>
<xsl:element name="body">
...
<xsl:copy-of select="MyTag/content/div"></xsl:copy-of>
...
</xsl:element>
</html>
I tried changing
<xsl:copy-of-select>
by
<xsl:for-each select="//MyTag/content/*">
<xsl:calltemplatename="node"/>
</xsl:for-each>
...
<xsl:template name="node">
<xsl:variable name="name" select="name()"/>
<xsl:element name="{$name}">
<xsl:copy-of select="@*" />
<xsl:if test="child::*">
<xsl:for-each select="current()/*">
<xsl:call-template name="node"/>
</xsl:for-each>
</xsl:if>
<!-- first attempt -->
<xsl:value-of select="translate(text(),'&','&')" />
<!-- second attempt -->
<xsl:value-of select="concat('<![CDATA[', text(),']]>')" />
</xsl:element>
</xsl:template>
To solving this I can´t modify the JSP. Just can modify the XSL.
Thanx in advance.