Copied to clipboard

Flag this post as spam?

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


  • Ben 91 posts 111 karma points
    Dec 12, 2011 @ 08:05
    Ben
    0

    Finding a property value by its alias(in xslt)

    Hi,

    Is there a way to find a property value by its alias, which is stored in a variable (with the new xml schema)?

    I don't want to find it like this: $currentPage/aliasName.

    I want somwthing similar to the old schema method: $currentPage/data[@alias='aliasName']... and then I'll use the following code (which is correct only for the old schema):

    <xsl:variable name=aliasName select='aliasName' />

    $currentPage/data[@alias=$aliasName]

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Dec 12, 2011 @ 08:30
    Dennis Aaen
    0

    Hi Ben,

    One option could be to switch to the old XML schema, even if you use a newer version of Umbraco.

    I do not know if you ever knew was possible.

    But hope this link may help you further.

    http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/switching-between-old-and-new-schema

    /Dennis

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

    Hi Ben

    With the new schema, the following should work:

    <xsl:value-of select="$currentPage/*[name()=$aliasName]" />

    /Kim A

  • Ben 91 posts 111 karma points
    Dec 12, 2011 @ 08:37
    Ben
    0

    Thanks for your reply.

    Actually, I knew about the option, but I don't want to use only the old schema, becaause I use the new schema structure in many of my xslt files (and it's very confortable..). I just want to have an option to access a property value when I get its alias as a string...

     

  • Kim Andersen 1447 posts 2196 karma points MVP
    Dec 12, 2011 @ 08:45
    Kim Andersen
    0

    Ben, did you try the solution I provided?

    That should work for the new schema...

    /Kim A

  • Ben 91 posts 111 karma points
    Dec 12, 2011 @ 09:07
    Ben
    0

    Oh, I posted my last comment in a response to Dennis, I didn't see your suggestion.

    Seems like it's the solution i'm looking for - I'll check it and I'll let you know. THANKS!

  • Ben 91 posts 111 karma points
    Dec 12, 2011 @ 09:11
    Ben
    0

    Works fine. Thank you again

  • Kim Andersen 1447 posts 2196 karma points MVP
    Dec 12, 2011 @ 09:18
    Kim Andersen
    0

    Coo, great Ben. I'm glad everything worked out for you :)

    /Kim A

  • Ben 91 posts 111 karma points
    Dec 12, 2011 @ 10:01
    Ben
    0

    By the way, can I access nodes by other properties in a similar way?

    for example, by the datatype id

  • Kim Andersen 1447 posts 2196 karma points MVP
    Dec 12, 2011 @ 10:10
    Kim Andersen
    0

    Hmm...I'm not sure I totally understand what you want to do. Can you give us an example?

    As far as I'm concerned you can't grab a property from a node by a data type id, if this is what you are trying to achieve.

    /Kim A

  • Ben 91 posts 111 karma points
    Dec 12, 2011 @ 11:11
    Ben
    0

    I try to grab a property(ultimate picker ddl) from a node by the rendered node id

  • Kim Andersen 1447 posts 2196 karma points MVP
    Dec 12, 2011 @ 11:46
    Kim Andersen
    0

    Hehe, sorry, but I think I'm a little slow this morning, but still don't get it totally I think.

    The id that you are talking about. Is this the id on the node, the id on the data type(the ultimate picker) or maybe the id of the selected value in the ultimate picker?

    Sorry for not understanding it all Ben.

    /Kim A

  • Ben 91 posts 111 karma points
    Dec 12, 2011 @ 11:55
    Ben
    0

    OK, I'll explaine.

    When I create a new datatype of ultimate picker, I am requested to set the id of the node to render. For example: I create a datatype named 'types_ddl', I set the rendered node id to be 1234. now I have a dropdown list which is populated with the children of node 1234. I add this dropdown as a property of a document type. Let's name the porperty 'select_type'.

    What I wnat to achieve is the ability to grab the value of 'select_type' its rendered node id(in this case -1234), and not by its name('select_type').

  • Kim Andersen 1447 posts 2196 karma points MVP
    Dec 12, 2011 @ 16:52
    Kim Andersen
    0

    Ohh, now I think I know what you want. I haven't heard of anyone doing that stuff - finding a property on a node by using the node ID.

    But you can grab the selected values from the UltimatePicker and do stuff with the selected node if you preffer that.

    Otherwise I think we need to have some of the other wise guys in here to help you out - Sorry...

    /Kim A

Please Sign in or register to post replies

Write your reply to:

Draft