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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:47:23+00:00 2026-06-11T22:47:23+00:00

Edit: This question should read How do I point to an element in the

  • 0

Edit: This question should read “How do I point to an element in the context node?” Answer is quite simple in this situation. From Larsh’s response:
"my:Line_Item_Mod_0 = 'true'"

Also, forgive me if this was a highly obvious question; I didn’t know the terminology for “Context Node” which is probably why google and the StackOverflow search weren’t helping much.

Read the remainder of the question for context.

I need an XPath expression that returns the current Line_Item_Mod_0 value within each node in order to conditionally format an MS InfoPath form. I’m quite green to XPath and I don’t know what the appropriate term for this behavior (exhibited by an expression) is. Here is my XML:

<?xml version="1.0" encoding="UTF-8"?><?mso-infoPathSolution solutionVersion="1.0.0.504" productVersion="14.0.0" PIVersion="1.0.0.0" href="file:///C:\Documents%20and%20Settings\Chris\Local%20Settings\Application%20Data\Microsoft\InfoPath\Designer3\c37482678ae440c9\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:pc="http://schemas.microsoft.com/office/infopath/2007/PartnerControls" 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:Project_Information>
        <my:Line_Items>
            <my:Counter>1</my:Counter>
            <my:Authorized_Number>4</my:Authorized_Number>
            <my:XPathLINCounter>Line Item 1</my:XPathLINCounter>
            <my:Line_Item_Mod_0>false</my:Line_Item_Mod_0>
        </my:Line_Items>
        <my:Line_Items>
            <my:Counter>2</my:Counter>
            <my:Authorized_Number>7</my:Authorized_Number>
            <my:XPathLINCounter>Line Item 2</my:XPathLINCounter>
            <my:Line_Item_Mod_0>true</my:Line_Item_Mod_0>
        </my:Line_Items>
        <my:Line_Items>
            <my:Counter>3</my:Counter>
            <my:Authorized_Number>2</my:Authorized_Number>
            <my:XPathLINCounter>Line Item 3</my:XPathLINCounter>
            <my:Line_Item_Mod_0>false</my:Line_Item_Mod_0>
        </my:Line_Items>
    </my:Project_Information>
</my:MasterSection>
</my:myFields>

I am trying to evaluate whether the “mod” value for the current node is 1 or 0. I already have an expression that does this, but for some reason InfoPath conditional formatting doesn’t like it. You can see the results of this mod expression in the Line_Item_Mod_0 element.

All I need to do is target the Line_Item_Mod_0 element within each Line_Items node. I can’t seem to make an expression that returns the value of the Line_Item_Mod_0 for its parent node (or perhaps “current” is the correct term).

I.E. Line_Items node 1 would have an expression within it that ALWAYS returns the false value of Line_Item_Mod_0.

I realize this should be simple, but I can’t seem to get my expression to stick within its current node.

The expression (count(preceding-sibling::my:*) + 1) mod 2 > 0 generates the Line_Item_Mod_0 node but doesn’t play nice with conditional formatting if I apply it as a rule. I can’t tell why.

I want to try to bypass it and evaluate the “true” or “false” value directly.

  • 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-11T22:47:25+00:00Added an answer on June 11, 2026 at 10:47 pm

    Whenever the current node (context node) is a <my:Line_Items> element, the following XPath expression will return the value of its <my:Line_Item_Mod_0> child element:

    "my:Line_Item_Mod_0"
    

    This XPath expression will actually select an element node; if that element node is evaluated in a string context, its value will be the string content of its child text node, false or true. If you need to convert that to a boolean, use

    "my:Line_Item_Mod_0 = 'true'"
    

    Note however, that this XPath expression uses a namespace prefix. In order for that usage to be valid, you have to declare that namespace prefix in the context of the XPath processor. You haven’t shown any of the context of how you are invoking XPath, but if you do show us that, we should be able to help verify that that part is done correctly.

    Also you mention “conditional formatting” a couple of times, but with insufficient detail to do anything with. I’m treating it as unimportant for now, but if it’s important, please edit your answer to post examples so we can help you with it.

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

Sidebar

Related Questions

edit This question is solved! Having something weird. I'm using html { font-size: 100%
Edit: this question is outdated. The jsonlite package flattens automatically. I am dealing with
Edit This question has gone through a few iterations by now, so feel free
EDIT: This question is a duplicate of What is the difference between managed and
EDIT: This question was initially too general, I think. So What I really need
EDIT: This question is about finding definitive reference to MySQL syntax on SELECT modifying
[EDIT] This question is how do I do atomic changes to entity beans with
Edit : This question has already been asked and answered, and I apparently am
EDIT: This question is now redundant since Twitter no longer supports basic auth. I've
[EDIT: this question is about Mozilla Audio Data API which is no longer considered

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.