You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Callum Elliott <C....@student.lboro.ac.uk> on 2001/02/24 19:55:54 UTC
Namespace not supported
Hi,
I'm currently using xalan 2.0 with tomcat 3.2.1 and jdk 1.3. I've tried to
create an xml/xsl parser using my own jsp tags. Here is the code:
public int doStartTag() throws JspException {
IXmlData xmlDataObject =
(IXmlData)pageContext.getRequest().getAttribute(WebKeys.dataKey);
Element xmlData = xmlDataObject.toXml(XmlUtil.createDocument());
String xslRealPath =
pageContext.getServletContext().getRealPath(xslUri);
try {
TransformerFactory tfactory = TransformerFactory.newInstance();
Templates xslStylesheet = tfactory.newTemplates(new
StreamSource(xslRealPath));
Transformer transformer = xslStylesheet.newTransformer();
transformer.transform(new DOMSource(xmlData), new
StreamResult(System.out));
} catch (javax.xml.transform.TransformerConfigurationException tce)
{
throw new JspException(tce.getMessage());
} catch (javax.xml.transform.TransformerException te) {
throw new JspException(te.getMessage());
}
return EVAL_BODY_INCLUDE;
}
Here is my stylesheet
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" omit-xml-declaration="yes"/>
<xsl:template match="/">
<html>
<head><title>TEST</title></head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="collection">
<table border="1">
<tr>
<td>ID</td>
<td>CREATED</td>
<td>STATUS</td>
<td>REQUISITIONER</td>
<td>BUDGET HOLDER</td>
<td>COMMENTS</td>
<td>MODIFIED</td>
</tr>
<xsl:apply-templates/>
</table>
</xsl:template>
<xsl:template match="requisitions">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="requisition">
<tr>
<td><xsl:value-of select="@id"/></td>
</tr>
</xsl:template>
</xsl:stylesheet>
when I run this I get a namespace not supported error, I discovered that the
exception is thrown on this line:
Templates xslStylesheet = tfactory.newTemplates(new
StreamSource(xslRealPath));
I've tried transforming the two files using the Process class and they work,
but not in my jsp tag code.
Any ideas what the problem is?
Thanks in advance,
Callum Elliott