Improved select tag

Hi,

we implemented an improvement to our existing xapp:select tag according to the
proposal Christian posted some days ago:

see: Redesign of xapp:select

If the attribute ‘xquery’ is set, then the xapp:select uses the new functionality. On the other hand -when the attribute ‘xquery’ is not set - existing applications will not be attached and will still work as known.

When defining a XQuery expression in the ‘xquery’ attribute, then the attributes behavior like the following:
Attribute collection: collection where to send the xquery
Attribute xquery: xquery that returns a set of documents.
Attribute value: XPath expression to address a single node of the document
Attribute text: XPath expression to address a single node of the document
Attribute distinct: true or false

As an attachment you will find the necessary files for the new functionality.

Bye
Thorsten

Please follow the installation instructions:

--------------------------------------------------------------------------------

Installation instruction for the new xapp:select tag.

--------------------------------------------------------------------------------




  • 1. Download the contributed .zip file.

    Important:
    Create a backup copy of your Tamino X-Application environment because changes you have previously made may be overwritten.


  • 2. Unzip the file in your Tamino X-Application 4.1.1 environment.


  • 3. Execute the command script build.cmd to rebuild Tamino X-Application and integrate the new select tag.


  • 4. Execute the command script build1 examples.jsp to rebuild the JSP examples.


  • 5. Execute the command script build1 generator to rebuild the Tamino X-Application Generator.


Tip:
Delete the content of your Tomcat work directory to prevent irritations concerning Tomcat.


--------------------------------------------------------------------------------

Integrating the Tags into an Existing Web Application

--------------------------------------------------------------------------------


To integrate the changes:



  • 1. Proceed with the steps as described in the above section.

  • 2. Copy the file xapplication\lib\debug\xapplication.jar into the directory yourWebApplication\Web-Inf\lib\xapplication.jar.

  • 3. Copy the file xapplication_411src\com\softwareag\xtools\xapplication\jsp\xapplication.tld into the directory yourWebApplication\Web-Inf\jsp\xapplication.tld.


improved_xquery_select_tag.zip (25 KB)

Thanks Christian and Thorsten for this fix.
It works great!

I have a question and a comment though.

why is it nescessary to have the xquery create an element in which you store the value and text ?

eg: for $x in intput()/MyDoc return {$x/@id} {$x/element1}

I’m asking because at first I didnt read the post where this was specified. Initialy what I tried was the following which didnt work.

<xapp:select collection=“${MyCollection$}” xquery=“for $x in input()/MyDoc return $x” value=“./@id” text=“./type” distinct=“false”>

</xapp:select>

It would be more intuative to have the xapp:select/ operate as listed above if possible.


–joeycz

Hello Joey,

<xapp:select collection="${MyCollection$}" xquery="for $x in input()/MyDoc return $x" value="/MyDoc/@id" text="/MyDoc/type" distinct="false">
  <select name="MySelect"/>">
  </select>
</xapp:select>



Could you check your example with the XPath as shown above?

I had a look at the code. The XPath expressions ‘value’ and ‘text’ are evaluated on document node level. Therefore, they must be absolute or ‘./MyDoc/@id’ could also be ok.

If the absolute paths does not work, could you post the schema of ‘MyDoc’?

Bye,
Christian.

Hi Christian,

the absolute path suggestion you made works, thanks…

<xapp:select collection=“${MyCollection$}” xquery=“for $x in input()/MyDoc return $x” value=“/MyDoc/@id” text=“/MyDoc/type” distinct=“false”>

</xapp:select>