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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:11:37+00:00 2026-06-11T15:11:37+00:00

Is there a way to modify the following XPath expression to return the number

  • 0

Is there a way to modify the following XPath expression to return the number of previous “like” elements? I need a relative count of the number of like nodes in a given branch (I think it’s a branch…) This is being used in MS InfoPath:

count(../preceding-sibling::*) + 1

I believe that the structure of my sample XML prevents this from behaving as intended. You will note that all the “Count” values in my XML have the number 1. The DateRepeaterCounter value should reset in a new MasterRepeater node and the MasterRepeaterCounter should reflect the overall number of MasterRepeater nodes.

I have yet to overcome the learning curve with XPath.

<?xml version="1.0" encoding="UTF-8"?><?mso-infoPathSolution solutionVersion="1.0.0.25" productVersion="14.0.0" PIVersion="1.0.0.0" href="file:///C:\Documents%20and%20Settings\Chris\Local%20Settings\Application%20Data\Microsoft\InfoPath\Designer3\e1d38b31bb224d94\manifest.xsf" ?><?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.2"?>
<my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-09-07T14:19:10" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="en-us">
<my:PrimarySection>
    <my:MasterRepeater>
        <my:MasterRepeaterCounter>1</my:MasterRepeaterCounter>
        <my:DateSection>
            <my:DateRepeater>
                <my:Date>2012-09-12</my:Date>
                <my:DateRepeaterCounter>1</my:DateRepeaterCounter>
            </my:DateRepeater>
            <my:DateRepeater>
                <my:Date>2012-09-13</my:Date>
                <my:DateRepeaterCounter>1</my:DateRepeaterCounter>
            </my:DateRepeater>
            <my:DateRepeater>
                <my:Date>2012-09-14</my:Date>
                <my:DateRepeaterCounter>1</my:DateRepeaterCounter>
            </my:DateRepeater>
            </my:DateSection>
    </my:MasterRepeater>
    <my:MasterRepeater>
        <my:MasterRepeaterCounter>1</my:MasterRepeaterCounter>
        <my:DateSection>
            <my:DateRepeater>
                <my:Date>2012-09-15</my:Date>
                <my:DateRepeaterCounter>1</my:DateRepeaterCounter>
            </my:DateRepeater>
            <my:DateRepeater>
                <my:Date>2012-09-16</my:Date>
                <my:DateRepeaterCounter>1</my:DateRepeaterCounter>
            </my:DateRepeater><my:DateRepeater>
                <my:Date>2012-09-17</my:Date>
                <my:DateRepeaterCounter>1</my:DateRepeaterCounter>
            </my:DateRepeater>
    </my:DateSection>
    </my:MasterRepeater>
</my:PrimarySection>
</my:myFields>

EDIT & ANSWER

InfoPath was messing up the expression somehow… After entering the expression in one field and then copying it into another it stopped working correctly. Upon re-entering the epxression as formatted above, it resolved the issue. I will self answer when StackOverflow allows it. Thanks!

  • 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-11T15:11:38+00:00Added an answer on June 11, 2026 at 3:11 pm

    I’ll self answer this one as it turned out to be an InfoPath issue and not an XPath issue. InfoPath was messing up the expression somehow… After entering the expression in one field and then copying it into another it stopped working correctly. Upon re-entering the epxression as formatted above, it resolved the issue. Thanks for all your help!

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

Sidebar

Related Questions

is there way how to get name ov event from Lambda expression like with
Is there a way to modify a UIElement's contents? I have something like this:
In the following code, is there a way to modify the contents of a
Is there a way to modify the printf in order to output string on
Is there any way to modify the CSS properties of one table's cells based
is there a simple way to modify the InnerXml of a XElement? supose we
In git, is there any (simple) way to modify the index so that only
Is there a way to allow admins to modify the content of simple static
Is there an easy-ish way to modify the webform-form-tpl.php template to show disclaimer text
Is there a way to modify the value of a backreference? Example: In the

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.