Im fairly new to XUpdate and Ive been playing with some examples and running them through the XUpdate processor to see the results.
I have an example, which appends an item of data and assigns it a zero based id, as follows and am wondering why it dosent work:
xupdate:
<xu:modifications version="1.0" xmlns:xu="http://www.xmldb.org/xupdate"> <xu:variable name="id" select="count(/data/item)"/>
<xu:append select="/data"> <xu:element name="item"> <xu:attribute name="id"> <xu:value-of select="$id"/> </xu:attribute> </xu:element> </xu:append> </xu:modifications>
data:
<data> <item id="0"/> </data>
error:
Exception in thread "main" java.lang.Exception: XPath leads not to a Node or NodeList !
at org.xmldb.xupdate.lexus.commands.CommandObject.selectNodes(CommandObject.java:137)
at org.xmldb.xupdate.lexus.commands.VariableCommand.execute(VariableCommand.java:97)
at org.xmldb.xupdate.lexus.XUpdateQueryImpl.execute(XUpdateQueryImpl.java:188)
It gives a similar message if I dont use a variable and go:
<xu:attribute name="id"> <xu:value-of select="count(/data/item)"/> </xu:attribute>
It seems that the value of a vairable can only be a node or a node list and not a number or other primitive value. Is this correct acording to the spec or is a limitation of the implementation.
Thanks in advance, From Richard. -- ______________________________________________________________________ Lars Martin mailto:[EMAIL PROTECTED] SMB GmbH http://www.smb-tec.com
---------------------------------------------------------------------- Post a message: mailto:[EMAIL PROTECTED] Unsubscribe: mailto:[EMAIL PROTECTED] Contact administrator: mailto:[EMAIL PROTECTED] Read archived messages: http://archive.xmldb.org/ ----------------------------------------------------------------------