Copied to clipboard

Flag this post as spam?

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


  • Vincent DeCapite 64 posts 83 karma points
    Feb 02, 2011 @ 14:33
    Vincent DeCapite
    0

    XSLT Form Help

    Hi All,

    I really need some help on this because I am stumped on this one issue. I have an XSLT that I created a macro for so it can be rendered in a form. In the XSLT there is an option where the user and choose a 'Thank You' Page from a drop down but that does not seem to work.

    Here is the code:

    <?

     

    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:wsc.library="urn:wsc.library"

     

     

    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib wsc.library ">

     

    <

     

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

    <

     

    xsl:param name="currentPage"/>

    <

     

    xsl:param name="redirect" select="/macro/redirect" />

    <

     

    xsl:variable name="errorCode" select="umbraco.library:Request('errorcode')" />

    <

     

    xsl:variable name="errorControl" select="umbraco.library:Request('errorcontrol')" />

    <

     

    xsl:template match="/">

    <

     

    xsl:choose>

    <

     

    xsl:when test="umbraco.library:RequestServerVariables('SCRIPT_NAME') = '/umbraco/macroResultWrapper.aspx'">

    <

     

    xsl:call-template name="editor" />

    </

     

    xsl:when>

    <

     

    xsl:otherwise>

    <

     

    xsl:call-template name="main" />

    </

     

    xsl:otherwise>

    </

     

    xsl:choose>

    </

     

    xsl:template>

    <!--

     

    EDITOR -->

    <

     

    xsl:template name="editor">

    <

     

    h3>ENews Form</h3>

    <

     

    b>Redirect: </b>

    <

     

    xsl:value-of select="umbraco.library:NiceUrl($redirect)" />

    <

     

    br />

    </

     

    xsl:template>

    <!--

     

    MAIN -->

    <

     

    xsl:template name="main">

    <

     

    xsl:if test="$errorCode != ''">

    <

     

    span class="error">

    <

     

    p>

    <

     

    xsl:text>Error: ('</xsl:text>

    <

     

    xsl:value-of select="$errorCode" />

    <

     

    xsl:text>') '</xsl:text>

    <

     

    xsl:choose>

    <

     

    xsl:when test="$errorCode = 1">

    <

     

    xsl:text>There was a technical problem when we tried to subscribe you to email updates. Please try to submit the form again.</xsl:text>

    </

     

    xsl:when>

    <

     

    xsl:when test="$errorCode = 2">

    <

     

    xsl:text>There was a technical problem when we tried to subscribe you to email updates. Please try to submit the form again.</xsl:text>

    </

     

    xsl:when>

    <

     

    xsl:when test="$errorCode = 3">

    <

     

    xsl:text>You must provide your name in order to subscribe to email updates. Please click the back button and enter your name in the subscription form. (</xsl:text>

    <

     

    xsl:value-of select="$errorControl" />

    <

     

    xsl:text>)</xsl:text>

    </

     

    xsl:when>

    <

     

    xsl:when test="$errorCode = 4">

    <

     

    xsl:text>Please make sure you entered a valid email address. A valid address includes the @ symbol and a domain prefix (like .com or .edu). (</xsl:text>

    <

     

    xsl:value-of select="$errorControl" />

    <

     

    xsl:text>)</xsl:text>

    </

     

    xsl:when>

    <

     

    xsl:when test="$errorCode = 5">

    <

     

    xsl:text>You are already subscribed to US Endoscopys email updates. (</xsl:text>

    <

     

    xsl:value-of select="$errorControl" />

    <

     

    xsl:text>)</xsl:text>

    </

     

    xsl:when>

    <

     

    xsl:when test="$errorCode = 6">

    <

     

    xsl:text>There was a technical problem when we tried to subscribe you to email updates. Please try to submit the form again.</xsl:text>

    </

     

    xsl:when>

    <

     

    xsl:when test="$errorCode = 7">

    <

     

    xsl:text>There was a technical problem when we tried to subscribe you to email updates. Please try to submit the form again.</xsl:text>

    </

     

    xsl:when>

    <

     

    xsl:when test="$errorCode = 8">

    <

     

    xsl:text>You are already subscribed to US Endoscopys email updates.</xsl:text>

    </

     

    xsl:when>

    <

     

    xsl:when test="$errorCode = 9">

    <

     

    xsl:text>There was a technical problem when we tried to subscribe you to email updates. Please try to submit the form again.</xsl:text>

    </

     

    xsl:when>

    <

     

    xsl:when test="$errorCode = 10">

    <

     

    xsl:text>There was a technical problem when we tried to subscribe you to email updates. Please try to submit the form again.</xsl:text>

    </

     

    xsl:when>

    <

     

    xsl:when test="$errorCode = 11">

    <

     

    xsl:text>There was a technical problem when we tried to subscribe you to email updates. Please try to submit the form again.</xsl:text>

    </

     

    xsl:when>

    <

     

    xsl:otherwise>

    <

     

    xsl:text>Other</xsl:text>

    </

     

    xsl:otherwise>

    </

     

    xsl:choose>

    </

     

    p>

    <

     

    p>

    If you continue to encounter any errors, please

    <a href="{umbraco.library:NiceUrl(1084)}">Contact Us</a> for further assistance.

    </

     

    p>

    </

     

    span>

    </

     

    xsl:if>

    <!--

     

    Close .NET Form -->

    <

     

    xsl:text disable-output-escaping="yes">&lt;/form&gt;</xsl:text>

    <

     

    script type="text/javascript">

    <

     

    xsl:comment>

    <![CDATA[

     

    // isEmail (STRING s [, BOOLEAN emptyOK])

    // whitespace characters

    var whitespace = " \t\n\r";

     

    //

    // Email address must be of form [email protected] ... in other words:

    // * there must be at least one character before the @

    // * there must be at least one character before and after the .

    // * the characters @ and . are both required

    function isValidEmail(s)

    {

    if (isEmpty(s)) return false;

     

    // is s whitespace?

    if (isWhitespace(s)) return false;

     

    // there must be >= 1 character before @, so we

    // start looking at character position 1

    // (i.e. second character)

    var i = 1;

    var sLength = s.length;

     

    // look for @

    while ((i < sLength) && (s.charAt(i) != "@"))

    { i++

    }

     

    if ((i >= sLength) || (s.charAt(i) != "@")) return false;

    else i += 2;

     

    // look for .

    while ((i < sLength) && (s.charAt(i) != "."))

    { i++

    }

     

    // there must be at least one character after the .

    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;

    else return true;

    }

     

    // Check whether string s is empty.

    function isEmpty(s)

    {

    return ((s == null) || (s.length == 0))

    }

     

    // Returns true if string s is empty or

    // whitespace characters only.

    function isWhitespace(s)

    {

    var i;

     

    // Is s empty?

    if (isEmpty(s)) return true;

     

    // Search through string's characters one by one

    // until we find a non-whitespace character.

    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)

    {

    // Check that current character isn't whitespace.

    var c = s.charAt(i);

     

    if (whitespace.indexOf(c) == -1) return false;

    }

    // All characters are whitespace.

    return true;

    }

     

    function checkForm() {

    if (!isValidEmail(document.subscribeForm.elements['Email Address'].value)) {

    document.subscribeForm.elements['Email Address'].style.backgroundColor='yellow';

    alert("Please enter a valid Email Address. ([email protected])");

    document.subscribeForm.elements['Email Address'].focus();

    return false;

    }

    }

     

     

    ]]>

    </

     

    xsl:comment>

    </

     

    script>

    <

     

    form action="http://cl.exct.net/subscribe.aspx?lid=3052218" name="subscribeForm" method="post">

    <

     

    xsl:variable name="host" select="concat('http://', umbraco.library:RequestServerVariables('HTTP_HOST'))" />

    <

     

    xsl:if test="number($redirect)">

    <

     

    input type="hidden" name="thx">

    <

     

    xsl:attribute name="value">

    <

     

    xsl:value-of select="$host" />

    <

     

    xsl:value-of select="umbraco.library:NiceUrl($redirect)" />

    </

     

    xsl:attribute>

    </

     

    input>

    </

     

    xsl:if>

    <

     

    input type="hidden" name="err">

    <

     

    xsl:attribute name="value">

    <

     

    xsl:value-of select="$host" />

    <

     

    xsl:value-of select="umbraco.library:NiceUrl($currentPage/@id)" />

    </

     

    xsl:attribute>

    </

     

    input>

    <

     

    input type="hidden" name="MID" value="234832" />

    <

     

    input type="hidden" name="Email Type" value="HTML" checked="checked" />

    <

     

    input type="hidden" name="SubAction" value="sub_add_update" checked="checked" />

    <

     

    p>

    <

     

    label>

    <

     

    strong>Name:</strong>

    </

     

    label>

     

     

    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

    <

     

    input type="text" name="Full Name" />

    </

     

    p>

    <

     

    p>

    <

     

    label>

    <

     

    strong>Company Name:</strong>

    </

     

    label>

     

     

    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

    <

     

    input type="text" name="Company Name" />

    </

     

    p>

    <

     

    p>

    <

     

    label>

    <

     

    strong>*Email:</strong>

    </

     

    label>

     

     

    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

    <

     

    input type="text" name="Email Address" />

    </

     

    p>

    <

     

    p>

     

     

    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

    <

     

    input type="submit" value="Send" />

    </

     

    p>

    </

     

    form>

    <

     

    p>* Required Fields</p>

    <

     

    xsl:text disable-output-escaping="yes">&lt;form&gt;</xsl:text>

    </

     

    xsl:template>

     

    </

     

    xsl:stylesheet>

    The Problem is when I insert it into Umbraco instead of getting this:

    ENews Form

    Redirect: /enews-sign-up/thank-you.aspx
     Which means it has loaded successfully, I am get this instead:

    Error parsing XSLT file: \xslt\WSC.Form.ENews - Copy (2).xslt

    Any help would be much appreciated. Thanks

  • Sean Mooney 131 posts 158 karma points c-trib
    Feb 02, 2011 @ 15:28
    Sean Mooney
    0

    Have you tried adding ?umbdebugshowtrace=true to the end of the url and look at the trace information

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 02, 2011 @ 15:30
    Jan Skovgaard
    0

    Hi Vincent

    If Sean suggestions does not brign you closer to the soltuon, could you please try to submit your code again (not formatting it as code) since the above is very hard to read - me eyes are hurting :-)

    Cheers

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft