Copied to clipboard

Flag this post as spam?

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


  • Thomas 18 posts 39 karma points
    Jan 24, 2011 @ 15:41
    Thomas
    0

    Issue with umbraco.library:NiceUrl in umbraco v 4.5.2

    Afternoon, I wonder if anyone can help me with a problem I've been trying to solve for months?

    I upgraded to umbraco v 4.5.2 and ever since the following XSLT has failed to work correctly.  I can no longer get the href="" value to appear.

    If I remove the href attribute all together the rest of the Macro renders fine.

    Please can anyone provide any insight as to what I've missed & how to fix it?

    <?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:param name="landingPageProductLink" select="/macro/landingPageProductLink"/>
      <xsl:param name="landingPageProductThumbnail" select="/macro/landingPageProductThumbnail/node"/>
      <xsl:param name="landingPageProductTitle" select="/macro/landingPageProductTitle"/>
      <xsl:param name="landingPageProductText" select="/macro/landingPageProductText"/>
      <xsl:template match="/">
        <xsl:if test="$landingPageProductLink != ''">
          <xsl:element name="a">
            <xsl:attribute name="class">
              <xsl:text>landing-page-product</xsl:text>
            </xsl:attribute>       
                  <xsl:attribute name="href">
                      <xsl:value-of select="umbraco.library:NiceUrl($landingPageProductLink)"/>
                  </xsl:attribute>
                  <xsl:element name="img">
                          <xsl:attribute name="width">           
                      <xsl:text>102</xsl:text>               
                          </xsl:attribute>               
                        <xsl:attribute name="height">
                      <xsl:text>66</xsl:text>               
                          </xsl:attribute>               
              <xsl:attribute name="src">
                       <xsl:value-of select="$landingPageProductThumbnail/data[@alias='umbracoFile']"/>
              </xsl:attribute>
                </xsl:element>
                    <xsl:element name="p">
                    <strong><xsl:value-of select="string($landingPageProductTitle)"/></strong>
                    <br/>
                    <xsl:value-of select="string($landingPageProductText)"/>
                </xsl:element>
                </xsl:element>
          </xsl:if>
      </xsl:template>
    </xsl:stylesheet>

    Regards,

    Tom

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jan 24, 2011 @ 18:42
    Jan Skovgaard
    0

    Hi Thomas

    How is it not working anymore? Do you have trouble saving the XSLT in the umbraco editor or does it just fail on the website?

    /Jan

  • Thomas 18 posts 39 karma points
    Jan 25, 2011 @ 10:54
    Thomas
    0

    Hi Jan,

     

    Saving the XSLT within umbraco is not a problem, the editor doesn't flag any problems.  The macro only now fails on the website, showing the following error:

    ---

    Error parsing XSLT file: \xslt\[landing-page-product].xslt   Error parsing XSLT file: \xslt\[landing-page-product].xslt   Error parsing XSLT file: \xslt\[landing-page-product].xslt   Error parsing XSLT file: \xslt\[landing-page-product].xslt  

    ---

    Removing the following from the full macro above will enable the macro to render correctly, but obviously exclusing the href="" value.

                  <xsl:attribute name="href">
                      <xsl:value-of select="umbraco.library:NiceUrl($landingPageProductLink)"/>
                  </xsl:attribute>


    Regards,

    Tom

  • Tom Maton 387 posts 660 karma points
    Jan 25, 2011 @ 16:31
    Tom Maton
    0

    Hi Tom,

    for the landingPageProductLink what's the marco parameter type?

    Tom

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jan 25, 2011 @ 19:28
    Kim Andersen
    0

    Hi Thomas

    Does the $landingPageProductLink contain a nodeId or a textstring with a URL in it?

    If you are using a textstring to write in a URL in the landingPageProductLink-parametre, then you shall not use the NiceUrl-extension, but just do like this:

    <xsl:attribute name="href">
        <xsl:value-of select="$landingPageProductLink"/>
    </xsl:attribute>

    /Kim A

  • Thomas 18 posts 39 karma points
    Jan 26, 2011 @ 14:39
    Thomas
    0

    Hi,

    Thanks for your responses,

    "landingPageProductLink" has the parameter type of "contentPicker".

    Regards,

    Tom

  • Thomas 18 posts 39 karma points
    Jan 26, 2011 @ 14:43
    Thomas
    0

    Hi Kim A,

    I tried the code you suggested:

    ---

    <xsl:attribute name="href">
         <xsl:value-of select="$landingPageProductLink"/>
    </xsl:attribute>

    ---

    That actually returned a link to the node in the content tree: 

    http://my.domain.com/umbraco/dialogs/treepicker.aspx?rnd=7a022944bc7a4252b5eaf29651f57a00&id=-1&treeType=content&contextMenu=true&isDialog=false&app=content

    Any ideas please?

    Regards,

    Tom

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jan 26, 2011 @ 15:10
    Kim Andersen
    0

    Hi Thomas

    Can you try printing out what the $landingPageProductLink contains like this:

    <textarea>
    <xsl:value-of select="$landingPageProductLink" />
    </textarea>

    In the top of your template. Just to make sure that the variable actually contains a nodeId.

    /Kim A

  • Thomas 18 posts 39 karma points
    Jan 26, 2011 @ 15:31
    Thomas
    0

    Hi Kim A,

    I Get the following written out on the page when using you're code.

    (There are four instances on the page, each seems to have a unique identifier).

    /umbraco/dialogs/treepicker.aspx?rnd=5c4477a2c3e3488c8ec1832810ceb584&id=-1&treeType=content&contextMenu=true&isDialog=false&app=content

    /umbraco/dialogs/treepicker.aspx?rnd=7a022944bc7a4252b5eaf29651f57a00&id=-1&treeType=content&contextMenu=true&isDialog=false&app=content

    /umbraco/dialogs/treepicker.aspx?rnd=87362c05e84d4b708618d8ac09ab8119&id=-1&treeType=content&contextMenu=true&isDialog=false&app=content

    /umbraco/dialogs/treepicker.aspx?rnd=1bc117652a624780a10a1fb92aff5ab6&id=-1&treeType=content&contextMenu=true&isDialog=false&app=content

    Thanks,

    Tom

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jan 26, 2011 @ 19:36
    Kim Andersen
    0

    Hmm...that's pretty weird.

    So the macro called landingPageProductLink is a contentPicker right? And you have choosen a node in the content tree when you inserted the macro?

    Are you inserting the macro in a template, in a richtext editor or in a macro container?

    /Kim A

  • Thomas 18 posts 39 karma points
    Jan 27, 2011 @ 00:43
    Thomas
    0

    hi Kim A,

    The macro "[landing-page-product]" has an alias "landingPageProductLink" of the type "contentPicker".

    The user would have selected a node from the content tree to create the link.  (All was working fine till upgrading to umbraco v 4.5.2, but now this macro no longer works).

    The macro is XSLT but uses the "macro picker" plugin http://macropicker.codeplex.com/ to insert multiples of the same macro into the template.

    Regards,

    Tom

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jan 27, 2011 @ 08:59
    Kim Andersen
    0

    Hey Thomas

    Maybe you should try using the build-in Macro Container data type instead as the macropicker isn't compatible with v4.5+ yet as far as I know.

    /Kim A

Please Sign in or register to post replies

Write your reply to:

Draft