Copied to clipboard

Flag this post as spam?

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


  • David 13 posts 33 karma points
    Oct 29, 2010 @ 12:17
    David
    0

    Accessing a property from a Doc Type that doesn't have a template

    I am currently using v4.5.2 and have an issue trying to get a value from a property in a doc type that doesn't have a template.

    I basically have a list (DidYouKnowList) that contains items (DidYouKnowItem) neither of these doc types use a template as I just use them to allow the user to add items to the list to be rendered with a macro.

    My issue is that although I can list the items in the list I can't seem to access the property that is on the Doc Type (textString).

     

    Here is my XSLT:

    <xsl:variable name="dykFolderNode" select="$currentPage/DidYouKnowList" />

    <ul>
    <xsl:for-each select="$dykFolderNode/DidYouKnowItem">
                     <li>                                 
                            <xsl:value-of select="data [@alias='textString']" />
                     </li
    </xsl:for-each>
    </ul>

    What am I missing that I can't get the text out of the property?

  • Rich Green 2246 posts 4008 karma points
    Oct 29, 2010 @ 12:25
    Rich Green
    0

    Hi David,

    Seems like you are mixing up the old (pre 4.5) and new (post 4.5) xml schemas.

    Have a look here http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/no-more-@nodetypealias and here http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/xslt-examples-updated-to-new-schema

    Rich

  • David 13 posts 33 karma points
    Oct 29, 2010 @ 12:54
    David
    0

    Rich,

     

    Thanks for the reply.  I am still learning XSLT and not entirely sure why I can't just get the value of my property 'textString' out.  I can see the for-each bringing back the correct list if I change the value-of to <xsl:value-of select="@nodeName" /> so why doesn't  <xsl:value-of select="@textString" /> work?

    I really appreciate any help on this as it confuses the hell out of me :)

     

    Dave

  • Rich Green 2246 posts 4008 karma points
    Oct 29, 2010 @ 13:01
    Rich Green
    0

    Hi Dave,

    Open up the App_Data/Umbraco.config file and have a look at how the xml is structured, @nodeName is an attribute, where as textString is an element.

    This article may help http://www.w3schools.com/xml/xml_attributes.asp

    Let me know if it makes sense.

    Regards

    Rich

     

  • David 13 posts 33 karma points
    Oct 29, 2010 @ 13:10
    David
    0

    Rich,

     

    Thanks for your help, I sorted it out now ... all I needed to do was drop the @ 

     

    Dave

Please Sign in or register to post replies

Write your reply to:

Draft