new xapp:select bug ??

I ran across something that looks like a bug in the new xapp:select tag.

It seems like when I use the new xapp:select with an xquery expression that performs a query outside of the current document type, the existing document gets changed. I’m probably not explaining this very well so i have ziped up the relavant files and attached it to this post.
the file in question is apps_dev/capability/capability_templates/create.jsp
There are two schemas at play in this situation. apps/schemas/Capability.tsd and /apps_dev/schemas/CapabilityType.tsd
Test data for CapabilityType is located in apps_dev/schemas/instances


To reproduce the problem i have been experiencing edit the page create.jsp and look for the comments <!-- WITH NEW xapp:select – HAS BUG -->
uncomment the xapp:select related lines then
load the create.jsp page apps_dev/capability/capability_templates/create.jsp?:collection={NMPCollection}&:action=create&:schema=Capability&:document=CapabilityDocument
click on the Add button associated with "Notes"

I have been able to get arround this bug by using the code found in the block sorounded by the comment


X-Application Version: 4.1.1
Tamino Version : 4.1.1
Platform : Win2k, WebContainer : Tamocat 4.1.18
JDK Version : 1.4.1
files.zip (559 KB)

Hi Joey,

it isn’t the xapp:select tag causing your problems.

<xapp:edit select=".">
	<xapp:select collection="${NMPCollection$}" 
               xquery="for $x in input()/CapabilityType return <sel>{$x/@id}{$x/type}</sel>"
               value="/sel/@id" text="/sel/type" distinct="false">
	    <select name="VAL_type"> 		
            </select>
        </xapp:select>							
</xapp:edit>
</pre><BR><BR>It is the xapp:edit tag causing the problem. With the "." you are pointing to the current node within an existing context, but you aren't using a context tag(e.g. loop, browse...) and this place.<BR>Therefore the <B><xapp:edit select="."/></B> points to a wrong node.<BR><BR>If address the desired node by an absolute path, when your problem vanishes:<BR><pre class="ip-ubbcode-code-pre">
<xapp:edit select="/Capability/@primary_type_id">
	<xapp:select collection="${NMPCollection$}" 
               xquery="for $x in input()/CapabilityType return <sel>{$x/@id}{$x/type}</sel>"
               value="/sel/@id" text="/sel/type" distinct="false">
	    <select name="VAL_type"> 		
            </select>
        </xapp:select>							
</xapp:edit>



I have seen a second <xapp:edit select=".">…</xapp:edit> for parent. You need to change
it analogous:
<xapp:edit select="/Capability/@parent_id">.

Hope this will help you

Bye Thorsten

Ahh… i see… i’ve made this sort of error before. Thanks for pointing it out. I will remember to make sure that nodes are addressed absolutely outside of a context tag =)

thanks again…

–joeycz

Hello,

you are not outside of a context tag. The xapp:form defines your context. In your case it is the root node of the document ‘CapabilityDocument’. The path ‘.’ addresses this root node (“Capability”) and the commit of your form sets the content of this node to the value transmitted by the HTML select box. This is a simple text and therefore the content of node “Capability” becomes invalid. It looks like this

<Capability>
  selected text of HTML select box
</Capability>



So, it should be possible to use also relative paths like “./@parent_id”.

Bye,
Christian.