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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:04:55+00:00 2026-06-13T04:04:55+00:00

I have an object with data annotations for serialization. It has a boolean property

  • 0

I have an object with data annotations for serialization. It has a boolean property which is true (tested with debugger) so 100% certain, but when I have this in the xslt:

<xsl:for-each select="order/Coupons/orderedCoupons" >
    <tr>
        <td>Discount <xsl:value-of select="@code"/></td>
        <td>
            <xsl:choose>
                <xsl:when test="@isperc='true'">
                    <xsl:value-of select="@disvalue"/>%
                </xsl:when>
                <xsl:otherwise>Epic fail
                    &#8364; <xsl:value-of select="format-number(@disvalue, '#.###,00', 'euro')" />
                </xsl:otherwise>
            </xsl:choose>
        </td>
    </tr>
</xsl:for-each>

It always displays epic fail, so the test always fails. I also have tried:

  • @isperc=’true’
  • @isperc=1
  • boolean(@isperc)
  • @isperc = true()

some more background info: it is an asp.net object which I serialize with build in data annotations. The XSLT support in .Net is 1.0 only.

edit piece of my coupon.cs

[XmlAttribute("isperc")]
public bool IsPerc
{
    get { return _isPerc; }
}

it is not nullable, but as the 2nd commentor pointed out, what is the value of <xsl:value-of select="@isperc"/> well, it seems empty. it parses as nothing in the html. Not a whitespace, not null etc. that is strange because the boolean is true…

edit2 this also outputs nothing <xsl:value-of select="string(@isperc)"/>, so this also fails <xsl:when test="string(@isperc) = 'true'">

  • 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-13T04:04:57+00:00Added an answer on June 13, 2026 at 4:04 am
    <xsl:when test="@IsPerc = true()">
    

    should match a C# boolean type.

    A workaround I’ve seen is to convert the boolean value to a number, though;

    <xsl:when test="number(@IsPerc) > 0">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data object that is deep-cloned using a binary serialization. This data
I have a object that contains data from a DB. The object has a
I have a ASPXShceduler binded with object data source. It work fine, but when
My objects in a complex structure have a property Dictionary<Object, Object> Annotations , where
Say I have an object-like data record like this: $article = array( 'title' =>
I have a data() object containing some json. Is there a way I can
I have a data object -- a custom class called Notification -- that exposes
I have a data object that looks like this: { 'node-16': { 'tags': ['cuda'],
I have a array of two dimensions object[,] data; . I want to convert
I have converted an array to object data like this: <?php $myobject->data = (object)Array('zero','one','two');

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.