Copied to clipboard

Flag this post as spam?

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


  • Geoff Hill 6 posts 27 karma points
    Oct 04, 2013 @ 16:39
    Geoff Hill
    0

    Unable to get parent and id values

     

    Categorisation 2.3.1.0

    Umbraco 4.7.2

    Using XSLT

     

    I'm sure I'm missing something simple hereā€¦

     

    Using GetCategories() I am able to iterate through all my categories and display their names and description.  However, I can't seem to get the parent or id of any category.  If I use value-of to display either to the screen, it doesn't display anything and if I try to use an if test on id it doesn't match what I'm certain the value should be.  Apparently id was added to the XSLT in v2.3

     

    Also, the documentation could do with an update.  There is no mention of GetCategoriesFromCSV() in the Word doc.  Also, I could really use a FindCategoryByName() function, which was apparently added in v2.2 but it doesn't appear to be there. 

  • Geoff Hill 6 posts 27 karma points
    Oct 04, 2013 @ 17:37
    Geoff Hill
    0

    Think I've answered my own question, prob down to my inexperience with xsl.

    While

    <xsl:value-of select="./name" />

    works,

    <xsl:value-of select="./id" />

    doesn't, and needs to be

    <xsl:value-of select="@id" />

  • James Patterson 53 posts 192 karma points
    Oct 11, 2013 @ 22:38
    James Patterson
    0

    Hi Geoff,

    Apologies, it was not your fault, the documentation was incorrect and showed ID, Parent, Selectable and Enabled as elements of Category rather than attributes. 

    Your selector using ./id would work if ID was an element but since it's actually an attribute you needed to change this to @id.

    I've made changes to the documentation here; https://umbracocategories.codeplex.com/documentation

    As for the FindCategoryByName() method, there is one here; Auros.Categorisation.Categories.FindCategoryByName()

    Glad you managed to solve your problem!

    Cheers,
    James 

Please Sign in or register to post replies

Write your reply to:

Draft