I have the following  which checks for a string within the xml... however, I need to create another  test to check for 'Null' or no text within the variable $validItems at the 1st line...
<xsl:if test="$validItems[(Caption | CalltoAction)[string(.)]]">
 <div class="text">
   <xsl:choose>
     <xsl:when test="$horizontal">
       <div class="holder">
         <div class="frame">
           <div class="slides-descriptions">
             <xsl:apply-templates select="$validItems" mode="horizontal"/>
           </div>
           <div class="switcher"/>
         </div>
       </div>
     </xsl:when>
     <xsl:otherwise>
       <div class="slides-descriptions">
         <xsl:apply-templates select="$validItems" mode="vertical"/>
       </div>
       <div class="switcher"/>
     </xsl:otherwise>
   </xsl:choose>
 </div>
</xsl:if>
How would I go about testing the variable xsl:if test=$validItems?
If I understand what you're asking for,
<xsl:if test="$validItems[(Caption | CalltoAction)[not(string(.))]]">
will do it. In other words, "if there is an element in the $validItems node-set that has a Caption or CalltoAction child element whose string value is empty". You could also say
<xsl:if test="$validItems[(Caption | CalltoAction)[. = '']]">
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With