[XQZone General] JSP Tag library question

Jason Hunter jhunter at marklogic.com
Wed Jun 1 22:51:47 PDT 2005


Danny Sokolsky wrote:

> Hi Rashid,
> 
> This might not be the most elegant solution, but I think it will work...

Let me take a shot at more elegant:

xdmp:node-replace(
   doc("foo.xml")/contributor/@fname,
   attribute fname { "abc" }
)

The trick is using the computed constructor to build a new attribute 
node to replace the old.

For a fun alternative you can make an element with an attribute then use 
XPath to fetch the attribute off it:

xdmp:node-replace(
   doc("foo.xml")/contributor/@fname,
   <x fname="abc"/>/@fname
)

-jh-




More information about the General mailing list