Copied to clipboard

Flag this post as spam?

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


  • Mark 255 posts 612 karma points
    Oct 21, 2014 @ 14:52
    Mark
    0

    Getting url of page submitted from in xslt email workflow

    Contour 1.1.12

    I can't see how to display the url from this xml:

    <uformrecord>
        <state>Approved</state>
        <created>2014-10-21T11:47:01</created>
        <updated>2014-10-21T11:47:01</updated>
        <id>1e0b2f53-5338-48b7-b079-ea9d99ed6f17</id>
        <ip>88.7.46.126</ip>
        <pageid url="http://mysite.com/help/emailus/" name="Email us">5423</pageid>
        <memberkey email="" login=""></memberkey>
        <fields>
            <firstname record="1e0b2f53-5538-48b7-b073-ea9d99ed6f17" sortorder="1" pageindex="0" fieldsetindex="1">
                <key>dad0e688-4358-4b8f-a14b-f8e6a378afc3</key>
                <fieldKey>ba1bc39f-d9d5-4056-841c-382499068b78</fieldKey>
                <caption>First name*</caption>
                <datatype>String</datatype>
                <values><value><![CDATA[manny]]></value></values>
            </firstname>
        </fields>
    </uformrecord>

    Into this xslt file (see Url:...):

    <?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:param name="id" />
    
        <xsl:template match="/">
    
        <p>
          This is the list of values it contained, you can turn this email off under workflows in Umbraco Contour
        </p>
        Url: <xsl:value-of select="umbraco.contour:GetRecord($id)/uformrecord/pageid/@url" />
        <xsl:for-each select="$records//fields/child::*">
            <br/>
            <strong>
                <xsl:value-of select="./caption"/>
            </strong>
            <br/>
            &#160;&#160;&#160;&#160;<xsl:value-of select=".//value"/>
        </xsl:for-each>
    
        <xsl:value-of select="."/>
    
        </xsl:template>
    
    </xsl:stylesheet>

    What am I missing / doing wrong? I can't find out what parameters contour passes into the XSLT, only examples online that contain $records

  • Comment author was deleted

    Oct 21, 2014 @ 14:55

    To get an overview of the xml format check out this doc page http://our.umbraco.org/projects/umbraco-pro/contour/documentation/Developer/Working-with-Contour-data-in-XSLT/

    The record holds a pageid, which is the id of the page the record was submitted on, you can then use the library method umbraco.library:NiceUrl to fetch the full url

  • Mark 255 posts 612 karma points
    Oct 22, 2014 @ 16:18
    Mark
    100

    Hi @Tim

    It turned out that the url parameter is already in the @records xml, it's an attribute of the pageid element, as per the xml in my original post. This must have been added in at some point. So all I had to do was replace this line in my XSLT file:

    Url: <xsl:value-ofselect="umbraco.contour:GetRecord($id)/uformrecord/pageid/@url"/>

    With this:

    Url: <xsl:value-of select="$records/pageid/@url" />

    I didn't need to access the umbraco.library at all. I assume it's safe to use the url attribute of the pageid element for this version of Contour. I'd appreciate it if you'd let me know otherwise.

    Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft