Copied to clipboard

Flag this post as spam?

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


  • Jordy Vialoux 73 posts 103 karma points
    May 28, 2012 @ 01:20
    Jordy Vialoux
    0

    XSLT Niceurl mailto

    Hi Guys,


    Basically I'm wanting to let the client enter in their email within the "Text String" property within the front end of umbraco.

    Example: if they enter [email protected] my xslt needs to pick up the entered text and if a user clicks on the email link on the live site it will trigger the mailto function.

    Here is what I have so far

    I imagine I have done something wrong with the "href" section of the anchor.

    All suggestions welcome!

  • Nigel Wilson 945 posts 2077 karma points
    May 28, 2012 @ 02:50
    Nigel Wilson
    0

    Hi Jordy

    I am not sure on the functionality you are trying to build, but the href needs to be either wrapped in curly brackets, or as follows (I like this option as I find it easier to decipher later on, albeit a more verbose way of coding)

    <a>
    <xsl:attribute name="href">
    <xsl:value-of select="umbraco.library:NiceUrl(@ID)"/>
    </xsl:attribute>
    <xsl:value-of select="personalEmail"/>
    </a>

    As stated above, I am not sure on the exact functionality you are building, but hopefully this will help progress things for you.

    Nigel

  • Jordy Vialoux 73 posts 103 karma points
    May 28, 2012 @ 03:00
    Jordy Vialoux
    0

    Hi Nigel,

    I tried what you suggested and this broke my code unfortunately... "error parsing xlst..."

    What I am building is a listPeople function... the user creates a group of people and then individual persons. I need the site to spit out the list of people within a UL which it currently does - just having a hard time with the email going into the href as a mailto.

  • Nigel Wilson 945 posts 2077 karma points
    May 28, 2012 @ 03:24
    Nigel Wilson
    0

    Add "?umbDebugShowTrace=true" on your page to determine the cause of the error and paste error in forum.

    Probably also a good idea to post your code as well, but not as an image as you can't copy/paste then..

    Nigel

  • Jordy Vialoux 73 posts 103 karma points
    May 28, 2012 @ 03:34
    Jordy Vialoux
    0

    This is the error:

     

    umbracoMacro InnerException Value was either too large or too small for an Int32.
    Value was either too large or too small for an Int32.
      at System.Convert.ToInt32(Double value)
      at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
      at System.Xml.Xsl.Runtime.XmlQueryRuntime.ChangeTypeXsltArgument(XmlQueryType xmlType, Object value, Type destinationType)
      at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args)
      at System.Xml.Xsl.CompiledQuery.Query.(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, Double {urn:schemas-microsoft-com:xslt-debug}position, Double {urn:schemas-microsoft-com:xslt-debug}last, IList`1 {urn:schemas-microsoft-com:xslt-debug}namespaces) in C:\Inetpub\powermarketing.co.nz\xslt\listPeople.xslt:line 34
      at System.Xml.Xsl.CompiledQuery.Query.(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator , Double , Double )
      at System.Xml.Xsl.CompiledQuery.Query.Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
      at System.Xml.Xsl.CompiledQuery.Query.Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
      at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)
      at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results)
      at umbraco.macro.GetXsltTransformResult(XmlDocument macroXML, XslCompiledTransform xslt, Dictionary`2 parameters)
      at umbraco.macro.loadMacroXSLT(macro macro, MacroModel model, Hashtable pageElements)

     

    Here is my code:


    xsl:stylesheet [ ]>
    <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"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">


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

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

    <ul id="list-people">
      <xsl:for-each select="$currentPage/Person">
        <li class="clearfix">
          <div class="person-image">
            <xsl:if test="personImage > 0">
              <xsl:variable name="img" select="umbraco.library:GetMedia(personImage, 0)" />
              <xsl:variable name="imgPath" select="concat(substring-before($img/umbracoFile,'.'), '.jpg')" />
              <img class="person-image" src="{$imgPath}" width="140" height="130" alt="{@nodeName}" />
            xsl:if>
          div>
          <div class="person-info">
            <span><xsl:value-of select="@nodeName" />span>
            <span><xsl:value-of select="personJobTitle" />span>
            <p><xsl:value-of select="personDescription" />p>
           
            <a>
              <xsl:attribute name="href">
              <xsl:value-of select="umbraco.library:NiceUrl(@ID)"/>
              xsl:attribute>
              <xsl:value-of select="personEmail"/>
            a>
          div>
        li>
      xsl:for-each>
    ul>

    xsl:template>

    xsl:stylesheet>


     

     

     

     

     

     

  • Jordy Vialoux 73 posts 103 karma points
    May 28, 2012 @ 03:47
    Jordy Vialoux
    0

    Fixed it!!!

    This is what I was after:

     

    <a href="mailto:{personEmail}"><xsl:value-of select="personEmail" /></a>

Please Sign in or register to post replies

Write your reply to:

Draft