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).
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 :)
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?
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
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
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
Rich,
Thanks for your help, I sorted it out now ... all I needed to do was drop the @
Dave
is working on a reply...