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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:06:22+00:00 2026-06-11T19:06:22+00:00

The most recent successful query I ran was this one: let $doc := doc(‘test’)

  • 0

The most recent successful query I ran was this one:

let $doc := doc('test')  
for $v in $doc//item 
where $v/product_info/unit[.='9291']
return (
  <div class="seller_company">{ $v/seller_info/seller_company_id[position() lt 2]/text() } 
  </div>,
  <div class="seller_rating">{ $v/seller_info/seller_rating[position() lt 3]/text() }
  </div>
  )

But it seems it’s structured incorrectly because I receive 2 results in the second div rather than two seller_rating-classed div’s with one result per each. Looking at the code, it makes sense that I get these results. Trying to restructure the query, I’m perplexed. Here’s my progress:

let $doc := doc('test')//item
for $v in $doc
where $v/product_info/unit[.='9291']
  let $x := return $v/seller_info/seller_company_id,
    $y := return $v/seller_info/seller_rating
    for $resultx in $x/text()
    return
      <div id="seller_company_id>{ $resultx }</div>
    for $resulty in $y/text()
    return
      <div id="seller_rating">{ $resulty }</div>

The xml file being:

<item>
<item_number>1171270</item_number>
<seller_info>
<seller_company_id>6356</seller_company_id>
<seller_rating>C31</seller_rating>
<seller_rating>T150 hr.</seller_rating>
</seller_info>
<product_info>
<unit>2022</unit>
<sinfo>55 cases</sinfo>
<sinfo>Yu-gi-oh trading card pack</sinfo>
<sinfo>.45kg per unit</sinfo>
<sinfo>24.7500kg shipment</sinfo>
</product_info>
<product_info>
<unit>9291</unit>
<sinfo>7 units</sinfo>
<sinfo>Naruto, Classic, action figure</sinfo>
<sinfo>1.8kg per unit</sinfo>
<sinfo>12.6kg shipment</sinfo>
</product_info>
</item>

I can’t help but feel that this is the wrong way to structure the query because when I don’t believe that the results can be ordered well/without the addition of a further-complex structure. If anyone is able to understand the desired output, please help me restructure my query.

Current output:

<div>6356</div><div>C31T150 hr.</div>

Desired output:

<div class="seller_company_id">6356</div>
<div class="seller_rating">C31</div>
<div class="seller_rating">T150 hr.</div>
  • 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-11T19:06:23+00:00Added an answer on June 11, 2026 at 7:06 pm

    Please poste valid code. There are lots of syntax errors in there! Code not accepted by the compiler is very bad style and doesn’t show you’re trying hard to fix the problems yourself. If you don’t know what the problem is, build a shorter example and try to fix it again, if you really don’t get it ask a question here.

    • no return in let-clauses
    • missing " after seller_company_id
    • missing sequence (actually exactly the stuff I answered in your last question)

    This nearly does what you want, I didn’t change id to class. I removed some of the let-clauses, add them again if you think it’s more readable for you.

    for $v in doc('test')//item
    where $v/product_info/unit[.='9291']
    return
        for $resultx in $v/seller_info/seller_company_id/text()
        return
        (
          <div id="seller_company_id">{ $resultx }</div>,
          for $resulty in $v/seller_info/seller_rating/text()
          return
            <div id="seller_rating">{ $resulty }</div>
        )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently downloaded the most recent build of this awesome tool WSDL2OBJC from
I keep getting this error for different gems, the most recent is acts_as_reportable: no
This is most recent Anyone know why this wont redirect? function onGeoSuccess(event) { document.getElementById(Latitude).value
Traceback (most recent call last): File manage.py, line 10, in <module> execute_from_command_line(sys.argv) File D:\PythonPack\lib\site-packages\django\core\management\__init__.py,
Traceback (most recent call last): File <pyshell#9>, line 1, in <module> ClosestCommonAncestor(A,C,x) File C:\x\x.py,
I've downloaded the most recent Windows.Phone.Controls.Toolkit and in the app.xaml.cs changed RootFrame = new
After Jeph most recent post: http://www.codinghorror.com/blog/archives/001310.html , I thought to myself it would be
I downloaded the most recent version of Android for Linux (android-sdk_r05-linux_86.tgz). I was trying
I am using the most recent version of GHC distributed with Ubuntu 11.10 (7.0.3).
I am trying implement a most recent widget into my tumblr post. So far,

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.