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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:37:21+00:00 2026-06-09T09:37:21+00:00

This is going to be a really simple question I’m sure. I have an

  • 0

This is going to be a really simple question I’m sure. I have an xml document that I’m transforming via XSL. The important part of this xml looks like this:

<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Transaction>
    <EnrollmentModel>
      <FutureContributionsModel>
        <FutureContributionsElectionType>ACertainThirdParty</FutureContributionsElectionType>
      </FutureContributionsModel>
    </EnrollmentModel>
  <Transaction>
</root>

And I want to add the following if the value of <FutureContributionsElectionType> does, in fact, equal ACertainThirdParty:

<fo:table-row>
    <fo:table-cell>
        <fo:block font-family="verdanaPS" font-size="9" padding-bottom="15px" padding-top="10px">
                        The Participant has successfully opted in to use ACertainThirdParty as the managed provider for the account.
        </fo:block>
    </fo:table-cell>
</fo:table-row>

Note that there is only one third party, so I don’t need to get the value of the node for the custom text, I can just hard-code it in there.

If the value of <FutureContributionsElectionType> does NOT equal ACertainThirdParty, I wan’t to add a whole bunch of other stuff.

Here’s what I tried:

So this seems like a job for <xsl:choose> and <xsl:when> / <xsl:otherwise>, right?
Here’s what I got:

<xsl:choose>
  <xsl:when test="FutureContributionsModel/FutureContributionsElectionType='ACertainThirdParty'">
    <fo:table-row>
      <fo:table-cell>
        <fo:block font-family="verdanaPS" font-size="9" padding-bottom="15px" padding-top="10px">
                        The Participant has successfully opted in to use ACertainThirdParty as the managed provider for the account.
        </fo:block>
      </fo:table-cell>
    </fo:table-row>
  </xsl:when>
  <xsl:otherwise>
    <fo:table-row>
      <fo:table-cell>
          ...
          Lots of stuff
          ...
      </fo:table-cell>
    </fo:table-row>
  </xsl:otherwise>
</xsl:choose>

But when I transform it, the otherwise code gets hit rather than the correct code (in my xml the value is indeed ACertainThirdParty. My guess is my problem is that I don’t know XPath, so I’m probably assuming I can do things that I can’t. What’s going on here?

  • 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-09T09:37:23+00:00Added an answer on June 9, 2026 at 9:37 am

    Most probably the context (current node) isn’t Transaction.

    You can use an absolute XPath expression:

    /*/Transaction/EnrollmentModel/FutureContributionsModel/FutureContributionsElectionType='ACertainThirdParty'
    

    Much better, avoid using explicit conditionals — use templates and template match patterns:

    <xsl:template match="FutureContributionsElectionType[.='ACertainThirdParty']">
    
      <!-- Specific Processing Here  -->
    </xsl:template>
    
    <xsl:template match="FutureContributionsElectionType[not(.='ACertainThirdParty')]">
    
      <!-- Other Specific Processing Here  -->
    </xsl:template>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm going to run this really simple cod that will be compiled in visual
I am sure this is something really simple, but I am going bonkers trying
Simple question, really. I just don't have the knowledge to do this with JavaScript,
This is probably going to be a really simple fix... I just can't figure
This is going to be a stupid question but I have spent an inordinate
This is a really simple question but I havn't done c++ properly for years
This is probably a really simple question. How do I add an image to
I really didn't know how to ask this question in a simple fashion. I
This is hopefully going to be a really simple answer, I'm just not seeing
I have a question that's so simple I cannot believe I can't answer it

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.