Copied to clipboard

Flag this post as spam?

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


  • Max 144 posts 166 karma points
    Apr 27, 2011 @ 13:30
    Max
    0

    get Employee by sorting in xslt

    I want to sort the employees who are Founder/director and put it in main page or home page

    from The employees docuemtn types i added

    how can i put it in main Home page any ideas of creating an xslt for that

     

  • Kim Andersen 1447 posts 2196 karma points MVP
    Apr 27, 2011 @ 15:03
    Kim Andersen
    0

    Hi Max

    As I don't know your structure of your content, I'll just show you how you can grab all nodes of the type "Employee" in the entire tree.

    Try this:

    <xsl:variable name="root" select="$currentPage/ancestor-or-self::root" />
    <xsl:for-each select="$root//Employee">
    <xsl:value-of select="@nodeName" /><br/>
    </xsl:if>

    The above code will create a list of all the nodes with a document type of Employee. It's not at all the most beautiful solution, but if you could show us your content structure we could maybe make a little more effective code.

    But you can place the above code on any of your pages to show the list of Emplayee's. I hope it makes sense :)

    /Kim A

  • Max 144 posts 166 karma points
    Apr 28, 2011 @ 11:31
    Max
    0

    i solved it using this

     

     

    <xsl:for-each select="$currentPage/ancestor-or-self::root//* [name() = $documentTypeAlias and string(umbracoNaviHide) = '1'] ">

    </xsl:for-each>

     u can use =1 in case ur hiding a page usign UmbraconaviHide

    Thanks Guys

    <xsl:variable name="documentTypeAlias" select="string('EmployeeRecords')"/>

  • Kim Andersen 1447 posts 2196 karma points MVP
    Apr 30, 2011 @ 10:55
    Kim Andersen
    0

    Hi Max

    Yeah that makes perfectly sense to me. You can change the code a bit, to make it shorter and delete the documentTypeAlias variable like this:

    <xsl:for-each select="$currentPage/ancestor-or-self::root//EmployeeRecords[string(umbracoNaviHide) = '1'] ">

     

    /Kim A

Please Sign in or register to post replies

Write your reply to:

Draft