Copied to clipboard

Flag this post as spam?

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


  • Elad Lachmi 112 posts 144 karma points
    Apr 17, 2011 @ 10:23
    Elad Lachmi
    0

    ucomponents url picker

    Hi,

    I just installed ucomponents and I'm using the url picker.

    I was wondering if anyone can show me a simple example of accessing the properties of the XML in XSLT.

    I'm new to XSLT and I don't even know where to begin.

    Sorry for the noobness :)

    Thank you!

  • Rich Green 2246 posts 4008 karma points
    Apr 17, 2011 @ 11:29
    Rich Green
    1

    Hi Elad,

    I've not used it but from looking at their documentation here http://ucomponents.codeplex.com/wikipage?title=UrlPicker&referringTitle=Documentation

    If you have the results set to XML then you can grab the values like this:

    <xsl:value-of select="$currentPage/NameOfYourAlias/url-picker/new-window">
    <xsl:value-of select="$currentPage/NameOfYourAlias/url-picker/node-id">
    <xsl:value-of select="$currentPage/NameOfYourAlias/url-picker/url">
    <xsl:value-of select="$currentPage/NameOfYourAlias/url-picker/link-title">

    Let me know if this produces some output and then we can go from there.

    Rich

  • Elad Lachmi 112 posts 144 karma points
    Apr 17, 2011 @ 12:21
    Elad Lachmi
    0

    Yep. That did the trick.

    Just made a few small modifications. This is the line of code I endded up using:

     

    <xsl:value-of select="./partnerLink/url-picker/url" />

     

    Thank you!

  • Elad Lachmi 112 posts 144 karma points
    Apr 17, 2011 @ 12:26
    Elad Lachmi
    0

    Also added a little something to check for the new-window attribute:

    <div class="partner-link">
    <a>
    <xsl:attribute name="href">
    <xsl:value-of select="./partnerLink/url-picker/url" />
    </xsl:attribute>
    <xsl:if test="./partnerLink/url-picker/new-window">
    <xsl:attribute name="target">_blank</xsl:attribute>
    </xsl:if>
    Website Link
    </a>
    </div>

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Apr 17, 2011 @ 22:31
    Chriztian Steinmeier
    1

    Hi Elad,

    Because it's just a string value, you'll need to test for the specific value 'True' inside the new-window element for it to work as expected (try unchecking the box and see that it will still render the target attribute) - you can do it like this:

    <div class="partner-link">
        <a href="{partnerLink/url-picker/url}">
            <xsl:if test="partnerLink/url-picker/new-window[. = 'True']">
                <xsl:attribute name="target">_blank</xsl:attribute>
            </xsl:if>
            Website Link
        </a>
    </div>
    

    - or if you (like me) prefer separate templates, like this:

    <xsl:template match="/">
        ...
        <div class="partner-link">
            <a href="{partnerLink/url-picker/url}">
                <xsl:apply-templates select="partnerLink/url-picker/new-window[. = 'True']" />
                Website Link
            </a>
        </div>
        ...
    </xsl:template>
    
    
    <xsl:template match="new-window[. = 'True']">
        <xsl:attribute name="target">_blank</xsl:attribute>
    </xsl:template>
    

    /Chriztian

  • Biagio Paruolo 1618 posts 1910 karma points c-trib
    Oct 21, 2011 @ 16:38
    Biagio Paruolo
    0

    Works!

  • Funka! 398 posts 661 karma points
    Apr 12, 2012 @ 03:28
    Funka!
    0

    Using Razor? Well so am I! Was looking for some help on how to do this in Razor.  Finally found this thread here : http://our.umbraco.org/projects/backoffice-extensions/ucomponents/questionssuggestions/22766-Retrieve-URL-Picker-data-in-Razor ... which I'm posting here in case someone else might benefit from it?

    P.S., I haven't actually tried the advice in the related linked page above. But it certainly looks simple/straight-forward enough to do!

  • urvish 9 posts 29 karma points
    Oct 30, 2012 @ 14:16
    urvish
    0

    hi,

     

     

    My Page URL is like ~/new-page.aspx??lang=en&mId=1556&sId=1557 as shown in above image...

     

    Now i want that when i open this page then my URL should be like this.. ~/New-page/Goog-page  as shown in image...

    Is this possible..??

     

    Can anyone have idea about that than please tel me..

     

    Thanks in Advance...

     

  • Craig100 1136 posts 2523 karma points c-trib
    May 16, 2013 @ 16:19
    Craig100
    0

    Hi,

    Having to update an old site and modify some XSLT (shiver).  I've added a uComponents Multi-Url Pick and given it an alias of "link".  I can't work out why I can't get to the data using either ./link/url-picker/url or $currentPage/link/url-picker/url

    <xsl:for-each select="$currentPage/* [name() = $documentTypeAlias and umbraco.library:DateGreaterThan(offerExpirationDate,Exslt.ExsltDatesAndTimes:datetime())]">
      
      <xsl:variable name="mediaId" select="number(image)" />
        <xsl:if test="$mediaId > 0">
            <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" />
            <xsl:if test="$mediaNode/umbracoFile">
             <div class="img-block">
                <p>## <xsl:value-of select="./link/url-picker/url"/> ##</p>
                
                  <a>
                  <xsl:attribute name="href">
                    <xsl:value-of select="./link/url-picker/url" />
                  </xsl:attribute>
                  <xsl:if test="./link/url-picker/new-window[. = 'True']">
                          <xsl:attribute name="target">_blank</xsl:attribute>
                  </xsl:if>
                  
                  <img src="/ImageGen.ashx?image={$mediaNode/umbracoFile}&amp;width=950&amp;constrain=true">
                      <xsl:attribute name="alt">
                          <xsl:choose>
                              <xsl:when test="title != ''">
                                  <xsl:value-of select="title"/>
                              </xsl:when>
                              <xsl:otherwise>
                                  <xsl:value-of select="$mediaNode/@nodeName"/>
                              </xsl:otherwise>
                          </xsl:choose>
                      </xsl:attribute>
                  </img></a>
              </div>

            </xsl:if>
        </xsl:if>
    </xsl:for-each

    Any pointers would be greatly appreciated

    Cheers,

    Craig

  • Craig100 1136 posts 2523 karma points c-trib
    May 16, 2013 @ 16:43
    Craig100
    1

    Panicked early again!  

    Turned out I had to use <xsl:value-of select="./link/multi-url-picker/url-picker/url" /> 

    Hope this helps someone else.

    Craig

  • Streety 358 posts 568 karma points
    Mar 03, 2014 @ 12:12
    Streety
    0

    This might help:

    http://refreshwebsites.co.uk/blog/get-data-from-ucomponents-multi-url-picker/

     

    Its for Razor on a 4.11.x site

     

    Best of luck

Please Sign in or register to post replies

Write your reply to:

Draft