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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:41:12+00:00 2026-05-27T19:41:12+00:00

How can I exclude result prefixes from an XQuery similiar to the XSLT exclude-result-prefixes

  • 0

How can I exclude result prefixes from an XQuery similiar to the XSLT exclude-result-prefixes attribute in XSL.

Currently my XQuery generates namespace prefixes for namespaces that are not part of the result set, but were part of the original payload.

  • 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-27T19:41:13+00:00Added an answer on May 27, 2026 at 7:41 pm

    XQuery doesn’t really have a built-in feature like the exclude-result-prefixes in XSLT. The serialization extension doesn’t seem to help there either. So you will have to do it yourself by processing the end result just before you return it. Shouldn’t be difficult though.

    The xqueryfunctions website has functions that could help, like functx:change-element-names-deep ( http://www.xqueryfunctions.com/xq/functx_change-element-names-deep.html ), but that doesn’t really fit the bill here. So, here a more specific solution of my own:

    declare function local:remove-prefixes($node as node(), $prefixes as xs:string*) {
        typeswitch ($node)
        case element()
            return
                if ($prefixes = ('#all', prefix-from-QName(node-name($node)))) then
                    element {QName(namespace-uri($node), local-name($node))} {
                        $node/@*,
                        $node/node()/local:remove-prefixes(., $prefixes)
                    }
                else
                    element {node-name($node)} {
                        $node/@*,
                        $node/node()/local:remove-prefixes(., $prefixes)
                    }
        case document-node()
            return
                document {
                    $node/node()/local:remove-prefixes(., $prefixes)
                }
        default
            return $node
    };
    

    HTH!

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

Sidebar

Related Questions

Is there a simple way I can exclude nulls from affecting the avg? They
How can I exclude null values from a count on an array? since count
I'm aware that you can do this: public ActionResult DoSomething([Bind(Exclude = CreationDate)] Item item)
I am writing an XSL template that pulls data from many secondary sources. An
Can I exclude the valudation rule for the ID property? Right now I get
How can a validation exclude a regexp? I'm looking for something like this: validates_format_of
How can you ignore files by Doxygen similarly as by Git's .git/info/exclude ? Doxygen
In Django you can use the exclude to create SQL similar to not equal
Possible Duplicate: SQL exclude a column using SELECT * [except columnA] FROM tableA? I
I know that I can create xml files programmatically by using DOM api in

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.