In the loop you don't have to call the $currentPage parameter because you are retrieving the values of all it's subnodes.
You can see some examples of the aliases that exits if you click on the button straight to the right of the blue "save" icon in the XSLT editor of Umbraco. Then you will get a prompt, which has a dropdown box, in which it says "Prevalues..." -
From here you can select between som default umbraco document properties such as @nodeName,@createDate and so on. These are standard properties and will always be there. Beneath the list of standard properties you can see your custom properties, which are named "data [@alias ='nameofyourproperty']" where "nameofyourproperty" is the name you have given the property.
If you for instance have created a property for rich text editing and called it "bodyText" in the alias field, when you created your document type under the "settings" section then it would be listed as data[@alias ='bodyText'] in the prevalues dropdown box.
XSTL Content
Hi friends, im using XST to show the content of a node, but i still cant. Im using this example
<ul>
<xsl:for-each select="$currentPage/node">
<li><a href="{umbraco.library:NiceUrl(current()/@id)}">
<xsl:value-of select="current()/@nodeName"/>
</a></li>
</xsl:for-each>
<xsl:value-of select="$currentPage/@nodeName"/>
</ul>
But i dont know how to show the CONTENT of each node, can you help me please?
Thank you my friends.
Hi Mario
If you have defined som properties on your document type you can access them in your XSLT by writing something like
<xsl:value-of select="$currentPage/data [@alias ='nameofyourproperty']" />
Since you are using a loop in your example you could write something like this
<ul>
<xsl:for-each select="$currentPage/node">
<li><xsl:value-of select="data[@alias = 'nameofyourproperty']" /></li>
</xsl:for-each>
</ul>
In the loop you don't have to call the $currentPage parameter because you are retrieving the values of all it's subnodes.
You can see some examples of the aliases that exits if you click on the button straight to the right of the blue "save" icon in the XSLT editor of Umbraco. Then you will get a prompt, which has a dropdown box, in which it says "Prevalues..." -
From here you can select between som default umbraco document properties such as @nodeName,@createDate and so on. These are standard properties and will always be there. Beneath the list of standard properties you can see your custom properties, which are named "data [@alias ='nameofyourproperty']" where "nameofyourproperty" is the name you have given the property.
If you for instance have created a property for rich text editing and called it "bodyText" in the alias field, when you created your document type under the "settings" section then it would be listed as data[@alias ='bodyText'] in the prevalues dropdown box.
I hope that it all makes sense to you :-)
/Jan
Thanks Jan =) I undestand a few more of the propierties of my node, thank you very much bro.
When i retrieve my content, this shows with additional html, like <p>. Any suggestion of how i can format the content?
I dont find the properties that you name, i have to click right in thew save icon of the xslt editor?
Thanks a lot =)
Glad it helped a little.
To get the html renderen you need to add the attribute "disable-output-escaping="yes" to the <xsl:value-of select="" />
This is primarily used when you are fetching rich text content, that has been formatted with HTML tags.
So you need to write <xsl:value-of select="data[@alias = 'bodyText'] disable-output-escaping="yes" />
No, you need to click to the icon next to it :) when you hold your mouse over it you'll see a title text saying "Insert XSLT:Value-of..."
Hope it helps :-)
Enjoy - hours of fun are waiting right ahead!
/Jan
Thanks again Jan, I have found the fields, thanks a lot my friend.
Hi Mario
Glad it helped. I just came across this blogpost by Frederik Vig that can maybe also be a good beginning reference for you.
http://www.frederikvig.com/2010/03/starting-out-with-xslt-in-umbraco/
/Jan
Arh ha, nice, another feed for the Umbraco Community Blogs :)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.