Copied to clipboard

Flag this post as spam?

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


  • vaibhav 119 posts 139 karma points
    Mar 11, 2011 @ 12:05
    vaibhav
    0

    Get name of source

    Hello,

    I want the name and url of the source in "List all subpages from changeble souce"......

    I am getting name but not url ....plz help me ....my code is .......

     

    <?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:BlogLibrary="urn:BlogLibrary"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary ">

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

    <xsl:param name="currentPage"/>

    <!-- Don't change this, but add a 'contentPicker' element to -->
    <!-- your macro with an alias named 'source' -->
            <xsl:variable name="source" select="macro/source"/>
    <xsl:template match="/">
                        <ul>
                          <li>
                           <a href="{umbraco.library:GetXmlNodeById($source)/@nodeName}">
                                <xsl:value-of select="umbraco.library:GetXmlNodeById($source)/@nodeName" />
                            </a>
                        <xsl:apply-templates select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']"/>
                          </li>
                        </ul>
            </xsl:template>
        <xsl:template match="*[@isDoc]">
                <ul>  
                    <li>
                            <a href="{umbraco.library:NiceUrl(@id)}">
                                    <xsl:value-of select="@nodeName" />
                            </a>
                        <!--    <xsl:if test="*[@isDoc][not(umbracoNaviHide = 1)]">
                                   <ul>
                                            <xsl:apply-templates select="*[@isDoc]" />
                                   </ul>
                            </xsl:if>  -->
                    </li>
              </ul>
            </xsl:template>

            <!-- No output for these -->
            <xsl:template match="*[umbracoNaviHide = 1]" />
    </xsl:stylesheet>

  • Rob Watkins 343 posts 593 karma points
    Mar 11, 2011 @ 13:33
    Rob Watkins
    0

    Don't you just want umbraco.library:NiceUrl($source) in the first "a href"? Looks like you are using the node name as the URL.

  • vaibhav 119 posts 139 karma points
    Mar 11, 2011 @ 14:04
    vaibhav
    0

    I i do this then the url shown is something liiike this ......

    http://www.domain.com/MySourceName/Texts written inside it   ...........which i dont want ......

    i want just ... http://www.domain.com/MySourceName

  • Tom Fulton 2030 posts 4996 karma points c-trib
    Mar 11, 2011 @ 22:24
    Tom Fulton
    0

    I think Rob is right, did you try:

    <a href="{umbraco.library:NiceUrl($source)}">

    Also can you confirm you are using the contentPicker as the macro parameter type and not contentTree?

    -Tom

     

  • vaibhav 119 posts 139 karma points
    Mar 12, 2011 @ 07:43
    vaibhav
    0

    If i am using

    <a href="{umbraco.library:NiceUrl($source)}">

    then it is giving error "System.OverflowException: Value was either too large or too small for an Int32."

    what to do now ?

    if i am using

    <a href="{umbraco.library:GetXmlNodeById($source)}">

    then i get url as http://www.domain.com/Node Which I Want / Content written in side it .....

    & if i am using

    <a href="{umbraco.library:GetXmlNodeById($source)/@nodeName}"> 

    then at 1st level i get proper url but when i navigate to 2nd level then i dont get proper url for 1st level node....

    Yes i am using content picker ......

     

    So please help to solve this ....

  • Kim Andersen 1447 posts 2196 karma points MVP
    Mar 12, 2011 @ 16:36
    Kim Andersen
    1

    Hi valibhav

    The error you describe in your latest post, does this only occour when you hit the save-button?

    Try this:

    <xsl:if test="$source!=''">
    <
    a href="{umbraco.library:NiceUrl($source)}">
    <xsl:value-of select="umbraco.library:GetXmlNodeById($source)/@nodeName" />
    </a>
    </xsl:if>

    /Kim A

  • vaibhav 119 posts 139 karma points
    Mar 14, 2011 @ 07:06
    vaibhav
    0

    Hi Kim Andersen ,

    Yes the error occures only when i hit the savo button.

    Thanx kim  & others , it solved my problem.

  • Kim Andersen 1447 posts 2196 karma points MVP
    Mar 14, 2011 @ 09:15
    Kim Andersen
    0

    Cool, great to hear vaibhav!

    /Kim A

  • 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