Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Andrew L 44 posts 44 karma points
    Jul 20, 2009 @ 10:02
    Andrew L
    0

    Return bool from xslt extension method

    Hi,

    I have setup a class for xslt extension methods and have got everything working. How do I return a simple boolean value to my xslt template now?

    e.g.

    public class UmbracoExtensionMethods {
        public static bool IsAllowed(){ return true; }
    }

    So I can use this method in my xslt like this:

    <xsl:if test="myExtensions:IsAllowed()">
  • Martin Bentzen 83 posts 145 karma points
    Jul 20, 2009 @ 10:36
    Martin Bentzen
    0

    Andrew,

    I will make the extension as you do, and in xslt use

    string(myExtensions:IsAllowed())=='1'

    Martin

  • Martin Bentzen 83 posts 145 karma points
    Jul 20, 2009 @ 10:39
    Martin Bentzen
    2

    Or even better:

    boolean(myExtensions:IsAllowed())
  • Ron Brouwer 273 posts 768 karma points
    Jul 20, 2009 @ 10:41
    Ron Brouwer
    0

    Hi Andrew,

    You can also use test="boolean(myExtensions:IsAllowed())"

    Ron

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies