You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Pavel Sher <pa...@actimind.com> on 2003/09/18 15:17:24 UTC
Jelly and XML tag library
Hello,
When I am trying to process the following Jelly script I've got the error:
[java] org.apache.commons.jelly.JellyTagException: file:/C:/Work/SDS/templates/sample1.xhtml:31:105: <x:transform> The node "org.dom4j.tree.DefaultElement@97d01f [Element: <h1 attributes: []/>]" could not be added to the branch "null" because: Cannot add another element to this Document as it already has a root element of: h1
[java] at org.apache.commons.jelly.impl.TagScript.handleException(TagScript.java:683)
Script:
<?xml version="1.0"?>
<j:jelly xmlns="http://my.uri.com" xmlns:j="jelly:core" xmlns:x="jelly:xml">
${systemScope.setProperty('javax.xml.transform.TransformerFactory','net.sf.saxon.TransformerFactoryImpl')}
${systemScope.setProperty('org.xml.sax.driver','org.apache.xerces.parsers.SAXParser')}
<html>
<head>
<title>The first sample</title>
</head>
<body>
<x:transform xslt="${basedir}/stylesheets/sample1-toc.xsl" xml="${basedir}/xml/sample1.xml" var="toc"/>
<x:transform xslt="${basedir}/stylesheets/sample1.xsl" xml="${basedir}/xml/sample1.xml" var="book"/>
<table border="1" cellspacing="0" cellpadding="0">
<tr>
<td>Table Of Contents</td>
</tr>
<tr>
<td>
<!-- TOC -->
<x:copyOf select="$toc"/>
<!-- TOC -->
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<!-- BODY -->
<x:copyOf select="$book"/>
<!-- BODY -->
</td>
</tr>
</table>
</body>
</html>
</j:jelly>
If I use comment out second <x:transform var="book"/> and remove second <x:copyOf/> then the script works fine. Maybe somebody knows why?
--
Best regards
Pavel Sher, pavel@actimind.com