Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7913159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:46:41+00:00 2026-06-03T13:46:41+00:00

Is it possible to make a link in an xquery file (.xq) a variable?

  • 0

Is it possible to make a link in an xquery file (.xq) a variable?

For example, I have the following link and I need to turn this into a variable so that I can use it with a for-contains code.

{ for $x in doc("myfile.xml")/portion/food
     return <li><a href="#link"></a>{data($x)}</li>}</ul>

{ for $y in doc("myfile.xml")/portion[contains(., <THIS IS WHERE THE LINK VARIABLE SHOULD GO>)]

I know to set a variable is as follows, but havent been able to put the 2 together to make it work

declare variable $hello := ("Hello World");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T13:46:43+00:00Added an answer on June 3, 2026 at 1:46 pm

    Your question combines different points that should be handled separately. If i understand correctly, you want to display a query result in a web browser, and you want to manipulate the DOM of the result page after it was created, on user interaction. The first part (display in browser) isn’t the problem, i think.

    Since the browser just displays the query result that’s serialized into a file (in the same way a simple text editor would do), there’s basically no “contact” or “communication” between browser and XQuery engine that would allow for re-evaluating any user interaction. So, your question basically asks how to create such a way of re-evaluating an XQuery based on a custom parameter.

    The eXist-db‘s documentation has an interesting yet simple example, a number-guessing game that requires server-side evaluation of user input and modifying the page content on each guess. It’s completely implemented in XQuery, using eXist-dbs’s session handling and XQuery Servlet capabilities.

    It should be quite easy to adapt the number guessing example to your needs. You don’t even need to track the guesses count, so it isn’t required to create a session on the server. It’s sufficient to send the selected item’s id with the request (as the example demonstrates with the guessed number, using a plain HTML form), and to evaluate that request property using an XQuery function. In the example, the local:guess function is responsible for this task, and it creates the appropriate HTML output, too.

    Such a solution depends on the XQuery engine’s capabilities. Maybe a “standalone” solution would be possible using Javascript, but that seems to be beyond the scope of the question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to make a link that does nothing? I want the item
Is it possible to make a whole table as link? I have a table
Is it possible to make a link with a .swf flash file, using swfObject?
Possible Duplicate: Implement linked list in php We can make link list in Java,
is it possible to make an imageview link to a web page such that
Is it possible make some handler that will do something when user shutdown computer
Is it possible make an activity, that will lock the android device? That device
Is it possible to make the item in preferencses.xml that will appear as gray
Is it possible to make my application un-erasable? By that I mean a lot
How is it possible to make prototype methods in C#.Net? In JavaScript, I can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.