Copied to clipboard

Flag this post as spam?

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


  • FarmFreshCode 225 posts 422 karma points
    Apr 05, 2013 @ 17:34
    FarmFreshCode
    0

    XSLT: If Statement - Show Content if 1 of X Variables are NOT empty

    So I use this solution which I got from Matt Brailsford back in the day from a question I asked here on the forums before... 

    <xsl:if test="string-length($currentPage/youTubeUrl) &gt; 0">
    <!-- insert video player code here -->
    </xsl:if>

    Which works great and I use it all the time... BUT now I need to check multiple strings for content before displaying a section.

    If (A) is empty but (B) is full then display the code... and vise-versa. Only if both strings are empty should the code as a whole not display.

  • FarmFreshCode 225 posts 422 karma points
    Apr 05, 2013 @ 17:37
    FarmFreshCode
    100

    SOLVED:  Well shortly after I started typing this question I came across the answer, but I thought I would post it anyway cause I didn'y find it here on the fourm

    <xsl:iftest="string-length($currentPage/youTubeUrl|$currentPage/websiteURL) &gt; 0">
    <!-- insert video player code here -->
    </xsl:if>

    All you need to do is list your variables with a | in between and youre all set.

    I came across the answer here: http://www.sourceware.org/ml/docbook-apps/2001-q3/msg00497.html

  • 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