I'm not too familiar with JXPath, and I'm sure it's useful in other contexts, but I don't see how it's applicable to Murray's problem. Can it be used to add an attribute to an existing element? I'm also not sure I get the point about "JXPath can be scripted into a JSP". Do you mean something besides:
<% Foo fooCtx = (Foo)JXPathContext.newContext(myFoo); %> Quoting "Mark R. Diggory" <[EMAIL PROTECTED]>: > This is outside the scope of the taglibrary, JSTL xml taglibrary is for > presentation of xml content, not for its manipulation. I recommend > looking into a package such as JXPath to accomplish manipulation of the > content of a DOM object. the nice thing is that JXPath can be scripted > into a JSP, Servlet or Struts Action, which gives you the fredom to move > it out of the Presentation layer (where you probibly shouldn't be > placing such logic). > > http://jakarta.apache.org/commons/jxpath/ > > Good Luck > -Mark > > Murray Lang wrote: > > > Hi > > I've been using the XML tags in JSTL and found them very useful, > > however now I need to add an attribute to an XML element and have hit > > a brick wall. > > > > I've tried using <c:set> and EL, treating a DOM object as a bean, but > > the DOM interface is implementation-dependent and my implementation > > (xerces) doesn't lend itself to adding attributes with the simple EL > > view of bean properties. > > > > It seems to me that <x:set> needs to have a "target"attribute along > > the same lines as <c:set>, but accepting an XPath expression. > > eg > > <x:set select="12345" > > target="$myRoot//myElement[position()=0]/@myAttribute" /> > > where: > > - select can be either an XPath expression or an immediate value. > > - if @myAttribute doesn't currently exist in the element then it > > is created. > > > > Does this make sense? > > Is there a simple, portable, way of achieving this using JSTL as it > > stands? (Using <c:set> is not portable due to DOM being implementation > > dependent). > > > > Thanks > > Murray -- Kris Schneider <mailto:[EMAIL PROTECTED]> D.O.Tech <http://www.dotech.com/> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]