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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:21:13+00:00 2026-05-25T11:21:13+00:00

In a recent project, I was able to use the following syntax to get

  • 0

In a recent project, I was able to use the following syntax to get distinct values from my XML file:

<xsl:for-each select="distinct-values($ds/datasource/Products-list/Products/CategoryName)">

But now, we are migrating the project to ASP.NET and the following code does not work:

public DataSourceManager manager = new DataSourceManager();

protected void Page_Load(object sender, EventArgs e)
{
    this.manager.Get("http:***",
            "distinct-values(/datasource/Products-list/Products/CategoryName)", 
            new String[] { "." }, this.messageRepeater);
    }
}

The Get function looks like:

public void Get(String datasourceUrl,
                String xpathToNodes,
                Array nodeNames,
                Repeater repeater,
                params String[] options ) {

    Debug.WriteLine("datasourceUrl= " + datasourceUrl);
    Debug.WriteLine("xpathToNodes= " + xpathToNodes);

    //call datasource url
    XmlDocument doc = new XmlDocument();
    doc.Load(datasourceUrl);

    //statusCode
    this.statusCode = doc.SelectSingleNode("/datasource/result/status/@code").Value;

    if (options.GetLength(0) > 0) {
        this.maxItem = Convert.ToInt16(options[0]);
    }

    //iterate
    this.list = new ArrayList();
    int count = 0;
    if (IsErrorCode == false) {
        XmlNodeList nodes = doc.SelectNodes(xpathToNodes);
        foreach (XmlNode node in nodes) {
            Hashtable row = new Hashtable();
            foreach (String nodeName in nodeNames) {
                row.Add(nodeName, node.SelectSingleNode(nodeName).InnerText);
            }
            list.Add(row);

            if (++count == this.maxItem) {
                break;
            }
        }
    }

    //data binding
    repeater.DataSource = list;
    repeater.DataBind();
}

The error returned is the following:

Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function.

How can I get distinct values in ASP.NET?

  • 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-25T11:21:14+00:00Added an answer on May 25, 2026 at 11:21 am

    I believe that the distinct-values function is only available in xslt 2.0. If you are doing anything with .NET built in XSLT functionality it only supports 1.0. This could explain your error.

    Unfortunately selecting distinct records on XSLT 1.0 can be a bit of a pain. This SO post goes over a good method for doing this:

    How to use XSLT to create distinct values

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

Sidebar

Related Questions

I will need to use multiple workspaces for a recent project. Each workspace might
for a recent project I need to detect file system changes on a mapped
In a recent project I'm using a lot of databinding and xml-serialization. I'm using
I'm having issues with using ctypes. I'm trying to get the following project running
A recent project has called for the use of two Hiragino fonts on iOS
I'm learning how to use the command line by requirement for a recent project.
In a recent project, I built my own MVC framework in PHP. One of
In a recent project I have nearly completed we used an architecture that as
Whilst working on a recent project, I was visited by a customer QA representitive,
In a recent project the lead developer designed a database schema where larger tables

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.