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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:31:20+00:00 2026-06-15T01:31:20+00:00

I am having much difficulty trying to operate on a variable value using when

  • 0

I am having much difficulty trying to operate on a variable value using when test=....

When I output $tcbrand it outputs 'Direct' but when I operate on it, it returns false and hits the otherwise block. What am I doing wrong?

    <fo:static-content flow-name="header-normal" font-size="10pt">  

                <xsl:variable name="tcbrand" select="smf:entity[@type='d2501b79-f888-4aa8-9fcf-a667a4c47c84']"/>

                <fo:block font-size="10pt" text-align="left">
                    <fo:inline font-weight="normal">Brand: <xsl:value-of select="$tcbrand"/></fo:inline>
                </fo:block>

                <xsl:choose>
                    <!--<xsl:if test="$image = 'hello' ">-->
                    <xsl:when test="string($tcbrand)='Direct'">
                        <fo:block text-align="right" space-before="0mm">
                            <fo:external-graphic src="url('C:\Program Files (x86)\numerointeractive\whitemail\Images\18-30.png')" />
                        </fo:block>             
                    </xsl:when>

                    <xsl:otherwise>                         
                            <fo:block text-align="right" space-before="0mm">
                                <fo:external-graphic src="url('C:\Program Files (x86)\numerointeractive\whitemail\Images\ecom2.jpg')" />
                            </fo:block>             
                    </xsl:otherwise>                                
                </xsl:choose>

This is the xml that gets generated, which I am operating on:

 <smf:entity id="48659" type="d2501b79-f888-4aa8-9fcf-a667a4c47c84" confidence="1.0" author="2e0b99b3-9cba-4736-a59b-fe00b5f62871" validated="true" preferred="false" requiresComponentExtraction="false" changeTime="2012-11-26T14:47:28.840Z" nonPersistedId="false" modified="false">
           <smf:value>Direct</smf:value>
        </smf:entity>
  • 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-15T01:31:22+00:00Added an answer on June 15, 2026 at 1:31 am
    <xsl:variable name="tcbrand" select="smf:entity[@type='d2501b79-f888-4aa8-9fcf-a667a4c47c84']"/>
    

    will set the tcbrand variable to the smf:entity element. The string value of an element is the concatenation of all its descendant text nodes, which for

    <smf:entity id="48659" type="d2501b79-f888-4aa8-9fcf-a667a4c47c84" confidence="1.0" author="2e0b99b3-9cba-4736-a59b-fe00b5f62871" validated="true" preferred="false" requiresComponentExtraction="false" changeTime="2012-11-26T14:47:28.840Z" nonPersistedId="false" modified="false">
           <smf:value>Direct</smf:value>
        </smf:entity>
    

    means a newline, seven spaces, “Direct”, another newline, and another four spaces. This is not equal to “Direct”. I can think of three possible fixes: you could use

    <xsl:strip-space elements="*"/>
    

    at the top of your stylesheet, which will cause it to completely ignore all whitespace-only text nodes in the input document, you could normalize-space when doing the test:

    <xsl:when test="normalize-space($tcbrand)='Direct'">
    

    or you could take the value of the child <smf:value> element instead of the parent <smf:entity> one, either at the variable declaration point

    <xsl:variable name="tcbrand"
      select="smf:entity[@type='d2501b79-f888-4aa8-9fcf-a667a4c47c84']/smf:value"/>
    

    or at the point of the test

    <xsl:when test="$tcbrand/smf:value='Direct'">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to change the look of my Tkinter application but not having much
I am having some difficulty using a UIWebView to render PDF files on the
I'm trying to learn jquery and I'm having some difficulty figuring out how to
I'm having an interesting but difficult problem with my JavaScript code. Basically, I'm trying
I am having difficulty with my associations and have been digging around trying to
I'm having difficulty assigning a value to a string. The string is contained in
I am having difficulty trying to return values from an XML file. Here is
EDIT - added .h file I'm having difficulty trying to find the cause of
I'm trying to grok & work with Arrows, and am having some difficulty. I
I am surprised at how much difficulty I am having with this. I am

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.