tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rolf Niepraschk <Rolf.Niepras...@ptb.de>
Subject Trouble with "xtags:add"
Date Tue, 08 Nov 2005 15:17:29 GMT

Hello,

I can't solve the following simple problem:

This XML structure
-------------------
<A>
  <AA>
  </AA>
  <AA>
  </AA>
  <BB>
  </BB>
  <CC>
  </CC>
</A>
-------------------
should be modified to
-------------------
<A>
  <AA>
  </AA>
  <AA>
  </AA>
  <BB>
  </BB>
  <XX>Hugo</XX>
  <CC>
  </CC>
</A>
-------------------
I need the additional tag "XX" at the same level as "AA" just after "BB". All my
 trials results in the last position. The small jsp program at the end of this
email shows the problem. I have also tried the parameter "after" but with no
success (the parameter isn't described in the documentation!).

Many thanks in advance,

...Rolf

-------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
<%@ page isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://jakarta.apache.org/taglibs/string-1.1" prefix="str" %>
<%@ taglib uri="http://jakarta.apache.org/taglibs/xtags-1.0" prefix="xtags" %>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">

<c:set var="content">
<A>
  <AA>
  </AA>
  <AA>
  </AA>
  <BB>
  </BB>
  <CC>
  </CC>
</A>
</c:set>
<xtags:parse id="doc">${content}</xtags:parse>

<xtags:context context="${doc}" select="/">
<textarea readonly="true" cols="75" rows="12"><xtags:copyOf select="*" />
</textarea><br />

<c:set var="tmp" value="/A/BB[1]" />
<xtags:context context="${doc}" select="${tmp}">
<xtags:add after="true">
<xtags:element name="XX">Hugo</xtags:element></xtags:add>
</xtags:context>

<textarea readonly="true" cols="75" rows="12"><xtags:copyOf select="*" />
</textarea><br />

</xtags:context>

</body>
</html>
-------------------

-- 
|| Rolf Niepraschk c/o Physikalisch-Technische Bundesanstalt      ||
|| Abbestr. 2-12; D-10587 Berlin, Germany                         ||
|| Tel/Fax: ++49-30-3481-7316/7490, email: Rolf.Niepraschk@ptb.de ||


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message