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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:29:04+00:00 2026-06-11T06:29:04+00:00

I need to adapt the following XPath expression to return the Latest Amend_Start_Date from

  • 0

I need to adapt the following XPath expression to return the “Latest” Amend_Start_Date from the sample XML (from MS InfoPath):

//my:Amend_Data[0=count(following-sibling::my:Amend_Data)]//my:Amend_Start_Date

And the XML:

<?xml version="1.0" encoding="UTF-8"?><?mso-infoPathSolution solutionVersion="1.0.0.440" productVersion="14.0.0" PIVersion="1.0.0.0" href="file:///C:\Documents%20and%20Settings\Chris\Local%20Settings\Application%20Data\Microsoft\InfoPath\Designer3\1c02663d7ed84d09\manifest.xsf" ?><?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.2"?><?mso-infoPath-file-attachment-present?><my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2011-05-05T19:56:08" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="en-us">
<my:MasterSection>
    <my:Planning_Section>
        <my:Planned_Start_Date>2012-09-12</my:Planned_Start_Date>
        <my:Planned_End_Date>2012-09-14</my:Planned_End_Date>
    </my:Planning_Section>
    <my:Actual_Section>
        <my:Actual_Start_Date>2012-09-13</my:Actual_Start_Date>
        <my:Actual_End_Date>2012-09-15</my:Actual_End_Date>
    </my:Actual_Section>
    <my:Amend_Hider>
        <my:Amend_Info_Repeater_Group>
            <my:Amend_Info_Repeater>
                <my:Amend_Data>
                    <my:Amend_Start_Date>2012-09-16</my:Amend_Start_Date>
                    <my:Amend_End_Date>2012-09-21</my:Amend_End_Date>
                </my:Amend_Data>
            </my:Amend_Info_Repeater>
            <my:Amend_Info_Repeater>
                <my:Amend_Data>
                    <my:Amend_Start_Date>2012-09-23</my:Amend_Start_Date>
                    <my:Amend_End_Date>2012-09-27</my:Amend_End_Date>
                </my:Amend_Data>
            </my:Amend_Info_Repeater>
        </my:Amend_Info_Repeater_Group>
    </my:Amend_Hider>
</my:MasterSection>

I started using XPath last Thursday… So forgive me if I am in need of spoonfeeding. As it stands the listed expression returns all start date nodes from the sample XML. It is intended to return the “Latest” Amend_Start_Date but does not because the structure of the XML is such that the Amend_Start_Date nodes are not grouped together. In this example that would mean a correct expression would return a start date of 2012-09-23 and NOT 2012-09-16

There must be a way this can be accomplished! Somehow the relative path of the Amend_Data node must be modified… Any help is appreciated!

PS: This relates to a question I posted on Friday that can be found here. You may note the structural difference in the sample XML listed in that question v. this one.

  • 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-11T06:29:06+00:00Added an answer on June 11, 2026 at 6:29 am

    This:

    (//my:Amend_Data)[last()]//my:Amend_Start_Date 
    

    should do the trick.

    Without using last() you can try:

    //my:Amend_Info_Repeater[0=count(following-sibling::my:Amend_Info_Repeater)]/my:Amend_Data/my:Amend_Start_Date 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following script that I need to adapt to read from a
I need to find a date format which could adapt to the two following
I have an old skin that I need to adapt to the new MediaWiki
I have this custom validation attribute for validating a collection. I need to adapt
I need help writing a regex with grouping to match the following six input
I am following instructions from this MSDN article: How to: Sort a GridView Column
Following on from a previous question about sub-selects, I have an SQL statement with
I need to adapt lucene's StandardTokenizer to some special purposes regarding twitter data. At
The more I learn XPath the more I need back refererencing For example, when
I have a need to move ~10,000 files from one document library to another

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.