Copied to clipboard

Flag this post as spam?

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


  • Craig O'Mahony 364 posts 918 karma points
    Nov 03, 2015 @ 14:26
    Craig O'Mahony
    0

    XSLT Transformed email order

    Hi all,

    I'm using the below code to change the way that a Contour email looks (which works great) but the fields aren't displaying in the order that they created/displayed to the user. Could someone spare a few minutes to have a look where it's going wrong/what I need to do please?

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
    xmlns:user="urn:my-scripts"
    xmlns:umbraco.library="urn:umbraco.library"
    exclude-result-prefixes="xsl msxsl user umbraco.library">
    
      <xsl:output method="html" media-type="text/html" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
      doctype-system="DTD/xhtml1-strict.dtd"
      cdata-section-elements="script style"
      indent="yes"
      encoding="utf-8"/>
    
      <xsl:param name="records" />
    
      <xsl:template match="/">
        <table style="border-collapse:collapse;border:1px solid black;">
              <xsl:for-each select="$records//fields/child::*">
               <tr style="border:1px solid black;">
                      <td valign="top" style="border:1px solid black;padding:5px;font-family:Verdana,Helvetica,Arial,sans-serif;font-size:11px;">
                          <strong>
                           <xsl:value-of select="./caption"/>
                          </strong>
                    </td>
                    <td valign="top" style="border:1px solid black;padding:5px;font-family:Verdana,Helvetica,Arial,sans-serif;font-size:11px;">
                          <xsl:choose>
                             <xsl:when test="contains(.//value, '/umbraco/plugins/umbracoContour/files/')">
                                 <a href="http://{umbraco.library:RequestServerVariables('SERVER_NAME')}{.//value}">
                                     <xsl:value-of select=".//value"/>
                               </a>
                             </xsl:when>
                              <xsl:otherwise>
                                  <xsl:for-each select="./values/value">
                                      <xsl:if test="position() &gt; 1">
                                       <br />
                                      </xsl:if>
                                    <xsl:value-of select="umbraco.library:ReplaceLineBreaks(.)"/>
                               </xsl:for-each>
                              </xsl:otherwise>
                         </xsl:choose>
                      </td>
                </tr>
            </xsl:for-each>
          </table>
      </xsl:template>
    
    </xsl:stylesheet>
    

    Thanks, Craig

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Nov 03, 2015 @ 14:45
    Dennis Aaen
    0

    Hi Craig,

    Have you tried to use something like the code below.

    <xsl:for-each select="$records//fields/child::*">
         <xsl:sort select="./@pageindex" order="ascending"/>
         <xsl:sort select="./@fieldsetindex" order="ascending"/>
         <xsl:sort select="./@sortorder" order="ascending"/>
              <!--Do stuff-->
    </xsl:for-each>
    

    Hope this helps,

    /Dennis

  • Craig O'Mahony 364 posts 918 karma points
    Nov 03, 2015 @ 14:55
    Craig O'Mahony
    0

    Hi Dennis,

    I have my friend but still the ordering was amiss.

    Thanks, Craig

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Nov 03, 2015 @ 17:07
    Dennis Aaen
    0

    Hi Craig,

    Okay, then you could try use the approach that you can see in the thread https://our.umbraco.org/forum/umbraco-pro/contour/35638-Sorting-fields-in-xslt-formatted-email

    Hope this helps, to solve your case.

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft