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 4254298
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:03:50+00:00 2026-05-21T05:03:50+00:00

Newbie to XQuery. I am using XQIB (XQuery In the Browser, i.e. Zorba implemented

  • 0

Newbie to XQuery. I am using XQIB (“XQuery In the Browser”, i.e. Zorba implemented in JavaScript) to process it client-side.

In the following test document, if I click the first button, “Add Paragraphs” and then the second button, “Make some paragraphs bold”, it works as expected. However, if I click “Add Paragraphs” twice (regardless of whether or not I click the second button in-between), the second button stops working.

Is this likely a bug in XQIB or does XQuery just behave differently than I expect?

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XQIB Test</title>
<meta charset="UTF-8"/>
<script type="text/javascript" src="mxqueryjs/mxqueryjs.nocache.js"></script>
<script type="application/xquery">
declare default element namespace "http://www.w3.org/1999/xhtml";
declare namespace hresume="http://microformats.org/profile/hresume";
declare namespace hcard="http://microformats.org/profile/hcard";

declare updating function local:addparas($loc, $evtObj) {
    insert node <p>test1</p>
        as last into b:dom()//body,
    insert node <p>test2</p>
        as last into b:dom()//body
};

b:addEventListener(b:dom()//input[@value='Add paragraphs'], "onclick", xs:QName("local:addparas"))
</script>
<script type="application/xquery">
declare updating function local:boldparas($loc, $evtObj) {
    replace node b:dom()//p[.='test1'] with <p><b>test1</b></p>
};

b:addEventListener(b:dom()//input[@value='Make some parapgraphs bold'], "onclick", xs:QName("local:boldparas"))
</script>
</head>
<body>
<h1>Insert example</h1>
<input type="button" value="Add paragraphs" />
<input type="button" value="Make some parapgraphs bold" />
<p>Hey</p>
</body>
</html>
  • 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-05-21T05:03:51+00:00Added an answer on May 21, 2026 at 5:03 am

    What XQIB should do is raise a runtime error. In the situation that you describe, the target expression of the replace in local:boldparas returns a sequence of multiple nodes, where according to the specification, it must be a single node:

    If the result is non-empty and does
    not consist of a single element,
    attribute, text, comment, or
    processing instruction node,
    [err:XUTY0008] is raised.

    (taken from http://www.w3.org/TR/xquery-update-10/#id-replace)

    You will achieve the desired result by iterating the replace operation as follows:

    for $node in b:dom()//p[.='test1']
    return replace node $node with <p><b>test1</b></p>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Newbie to LINQ, and trying to write the following query... select f.Section_ID, f.Page_ID, f.SortOrder,
Newbie question. I’m writing an ASP.Net MVC app in VB.Net and have been using
Newbie question i have following function: function isadult($description) { $bad=/*comma separated bad words*/; $bad=explode(,,$bad);
A newbie vb.net question What is the side effects of defining a structure inside
Newbie question. I have a NSMutableArray that holds multiple objects (objects that stores Bezier
Newbie here...can I write one program which incorporates .NET LINQ and also various Java
Java Newbie here. I have a JFrame that I added to my netbeans project,
.NET newbie here... I'd like to make a button in a Windows form that
Total newbie question but this is driving me mad! I'm trying this: myInt =
I'm a newbie to pgsql. I have few questionss on it: 1) I know

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.