Copied to clipboard

Flag this post as spam?

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


  • Kalle Ekstrand 181 posts 259 karma points c-trib
    Feb 13, 2012 @ 14:26
    Kalle Ekstrand
    0

    Get all approved records in XSLT?

    Trying to fetch all approved records from i form with this:

    <xsl:variable name="records" select="umbraco.contour:GetRecordsFromForm('6ddf3ddd-9aab-4e99-886f-fb4ed4282529')//uformrecord[state='Approved']"/>

    But it returns Zero. any ideas?

    //Kalle

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Feb 13, 2012 @ 15:09
    Tom Fulton
    0

    Hi Kalle,

    That actually should work.  Are you sure you have approved records on that form?

    You can try outputting the raw XML and taking a look, make sure you see <state>Approved</state> for one or more records.  To output the XML:

    <textarea><xsl:copy-of select="umbraco.contour:GetRecordsFromForm('6ddf3ddd-9aab-4e99-886f-fb4ed4282529')"/></textarea>

    -Tom

  • Kalle Ekstrand 181 posts 259 karma points c-trib
    Feb 13, 2012 @ 16:14
    Kalle Ekstrand
    0

    Yes, I have approved records. and even if I change to 'Submitted' I still get zero records...

    <uformrecord><state>Approved</state><created>2012-02-08T10:21:36</created>

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Feb 14, 2012 @ 14:33
    Tom Fulton
    0

    Hmm, that's really strange.  The code you supplied works fine for me, it returns all of my approved records.  Strange.  Are you sure the rest of your code is right, how it's checking the $records variable?

    -Tom

  • Kalle Ekstrand 181 posts 259 karma points c-trib
    Feb 14, 2012 @ 15:53
    Kalle Ekstrand
    0

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary" xmlns:umbraco.contour="urn:umbraco.contour"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary umbraco.contour ">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:template match="/">
     
     
    <xsl:variable name="records" select="umbraco.contour:GetRecordsFromForm('6ddf3ddd-9aab-4e99-886f-fb4ed4282529')//uformrecord[state='Approved']"/> 
    <xsl:variable name="totalParticipants" select="count($records//uformrecord)"/>

    <p>Just nu är det totalt <xsl:value-of select="$totalParticipants"/> betalande och bekräftade deltagare!</p>  

    <ol>
      <xsl:for-each select="$records/uformrecord">
        <xsl:sort select=".//fields/namn//value"/>
        <li><strong><xsl:value-of select=".//fields/namn//value"/></strong>,&nbsp;<xsl:value-of select=".//fields/ort//value"/>&nbsp;(<xsl:value-of select=".//fields/önskadsnittfartigruppindelningen//value"/>)</li>
      </xsl:for-each>
      </ol>

    </xsl:template>

    </xsl:stylesheet>

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Feb 14, 2012 @ 15:56
    Tom Fulton
    0

    Hi,

    You should remove "/uformrecord" from the rest of your code, because in the records variable you are already selecting the uformrecord elements.

    Ex:

    <xsl:variable name="totalParticipants" select="count($records)"/>

    and

    <xsl:for-each select="$records">

    HTH,
    Tom

  • Kalle Ekstrand 181 posts 259 karma points c-trib
    Feb 14, 2012 @ 16:46
    Kalle Ekstrand
    0

    Works like a charm! Thanks Tom!

Please Sign in or register to post replies

Write your reply to:

Draft