Copied to clipboard

Flag this post as spam?

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


  • Dan Evans 616 posts 988 karma points
    Oct 14, 2015 @ 13:40
    Dan Evans
    0

    Grouping form entries in XSLT

    I am trying to group form entries on a page using XSLT. Basically I want them grouped by pageid so something like this but it doesn't work!

    <ul>
    <xsl:for-each select="(umbraco.contour:GetRecordsFromForm('212c46db-c878-437c-bb61-59142db20cbd')//uformrecord)">
    <xsl:sort select="pageid" data-type="number" order="ascending"/> 
        <xsl:if test="following-sibling::*[1]/pageid != pageid">
            <li>Venue: <xsl:value-of select="fields/venueanddate/values/value"/></li>
        </xsl:if>
        <li><xsl:value-of select="concat(pageid,': ',fields/venueanddate/values/value,': ',fields/forename/values/value,' ',fields/surname/values/value,': ',fields/pin/values/value)"/></li>
    </xsl:for-each>
        </ul>
    
  • Dan Evans 616 posts 988 karma points
    Oct 14, 2015 @ 15:28
    Dan Evans
    0

    I've worked it out, gosh XSLT is horrid, so glad I no longer have to use it regularly!

    <xsl:variable name="sortedcopy">
          <xsl:for-each select="umbraco.contour:GetRecordsFromForm('212c46db-c878-437c-bb61-59142db20cbd')//uformrecord">
            <xsl:sort select="pageid" data-type="number" order="descending"/>
            <xsl:copy-of select="current()"/>
          </xsl:for-each>
    </xsl:variable>
    <xsl:variable name="relItems" select="msxml:node-set($sortedcopy)" />
    
    
    
        <xsl:for-each select="$relItems/uformrecord">
        <xsl:if test="(preceding-sibling::uformrecord[1]/pageid != current()/pageid) or not(preceding-sibling::uformrecord[1])">
            <li><strong>Venue: <xsl:value-of select="fields/venueanddate/values/value"/></strong></li>
    
    
    
        </xsl:if>
        <li><xsl:value-of select="concat(fields/forename/values/value,' ',fields/surname/values/value,': ',fields/pin/values/value)"/></li>
    </xsl:for-each>
        </ul>
    
  • 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