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

  • Home
  • SEARCH
  • 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 6975827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:25:08+00:00 2026-05-27T17:25:08+00:00

I need to check if a particular value is there in a node list.

  • 0

I need to check if a particular value is there in a node list.

For now I am using for-each and I think this is not efficient.

<xsl:for-each select="$ChildList">
    <i><xsl:value-of select="current()"></xsl:value-of> and <xsl:value-of select="$thisProduct"></xsl:value-of></i><br/>
    <xsl:if test="string(current())=string($thisProduct)">
        <!--<xsl:variable name="flag" select="1"/>  -->
        <p><b>Found!</b>
</p>
    </xsl:if>
</xsl:for-each>

I shall like to get it in a single shot. How can I?

  • 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-27T17:25:09+00:00Added an answer on May 27, 2026 at 5:25 pm

    When used in the way you are using it, current() is the same as . (See section 12.4). However, the purpose of current (broadly speaking) is to be able get the context node of the whole expression from within a predicate (where . represents the context of the predicate).

    I imagine that the subtlety of this distinction may have caused some confusion.

    This XPath expression will only succeed if the string value of the context node of the whole expression is the same as $thisProduct. This is obviously not what you desire:

    $ChildList[string(current())=string($thisProduct)]
    

    This expression will succeed if there is a node within $ChildList that has the same string value as $thisProduct.

    $ChildList[string(.)=string($thisProduct)]
    

    i.e. it looks through $ChildList for a node where the expression string(.)=string($thisProduct) is true.

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

Sidebar

Related Questions

I need to check whether document element value is changed after particular operation using
I need to check the value of a particular variable alone from set of
i want something like this the user enter a website link i need check
I need to check whether a page is being redirected or not without actually
I need to check if a value lies in a range, however I can't
I need to set all select boxes to a particular value. Here’s the HTML:
I need to check programmatically (in .NET) whether a given user (domain account) is
I need to check the RequestType of an HttpRequest in ASP.NET (or WebRequest.Method ).
I need to check whether the user executing the script has administrative privileges on
I need to check all of my asp code to prevent SQL injection. Should

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.