Copied to clipboard

Flag this post as spam?

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


  • Christian Hansen 34 posts 204 karma points
    Jan 31, 2020 @ 12:22
    Christian Hansen
    0

    Umbraco Forms XSLT all fields where not empty

    Hello, i have created an Umbraco Form, and will be sending mail with xslt transformed mail. But how can i exclude empty fields which are not filled. My test example is just the default "sendXsltEmailSample.xslt" which right now just include all fields empty or not.

    <?xml version="1.0" encoding="utf-8"?>
    

    <h3>Intro</h3>
    <p>
      Hello, this is a sample email using xslt to convert a record into a custom email
    </p>
    
    <h3>the fields</h3>
    <ul>
      <xsl:for-each select="$records//fields/child::*">
        <li>
          <h4>
            Caption: <xsl:value-of select="./caption"/>
          </h4>
          <p>
            <xsl:value-of select=".//value"/>
          </p>
        </li>
      </xsl:for-each>
    </ul>
    
    <h3>The actual xml</h3>
    <xsl:copy-of select="$records"/>
    

  • Ambert van Unen 175 posts 818 karma points c-trib
    Jan 31, 2020 @ 13:41
    Ambert van Unen
    100

    You can use a 'test'

    ex:

     <xsl:if test=".//value !=''">
        <li>
            //print the caption and values
        </li>
     </xsl>
    
  • Christian Hansen 34 posts 204 karma points
    Jan 31, 2020 @ 14:22
    Christian Hansen
    0

    Do you also have a solution to exclude specific fields too. I have some fields i want to hide from the email which are filled. ?

  • Christian Hansen 34 posts 204 karma points
    Jan 31, 2020 @ 13:47
    Christian Hansen
    0

    Great thanks!

Please Sign in or register to post replies

Write your reply to:

Draft