Copied to clipboard

Flag this post as spam?

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


  • Brian Andersen 35 posts 66 karma points
    May 10, 2013 @ 11:47
    Brian Andersen
    0

    Get URL from content picker issue

    Hi

    I am having problems doing something very simple such as using the content picker to make a link. Is there a new syntax I am not aware off ? I am running "umbraco v 4.11.8 (Assembly version: 1.0.4869.17899)"

     

    Here is the code: (I am sure that id1 contains the node ID of the content picker)

    Error:

    Error occured
    
    System.OverflowException: Værdien var enten for stor eller for lille til en Int32. 
    ved System.Convert.ToInt32(Double value) 
    ved System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) 
    ved System.Xml.Xsl.Runtime.XmlQueryRuntime.ChangeTypeXsltArgument(XmlQueryType xmlType, Object value, Type destinationType) 
    ved System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args) 
    ved (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) 
    ved Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) 
    ved System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer) 
    ved System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results) 
    ved umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)

     

    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" 
        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:variable name="id1" select="$currentPage/teaserLink1"/>  
    <xsl:template match="/">
        <a href="{umbraco.library:NiceUrl($id1)}">HELP</a> 
    </xsl:template>
    </xsl:stylesheet>

  • Brian Andersen 35 posts 66 karma points
    May 10, 2013 @ 12:08
    Brian Andersen
    0

    Ok I found an answer allready in this forum. I had to surround the output with an If/then statement like this:

    <xsl:if test="string($id1) != ''">
    <a href="{umbraco.library:NiceUrl($id1)}">
    <img src="/images/temp-teaser.jpg" alt="" />
    </a>
    </xsl:if>

    Answer here: http://our.umbraco.org/forum/developers/xslt/1840-NiceUrl-problem

    /Brian

  • 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