Sorry but a complete newbie to Umbraco and xslt. I have a number of pages which sit under the Home page and some of these (Sale pages) also have descendants. I want to present a date (called auction date) from the first one of these on the home page. The following code works fine to get the child page title but I can't see how to reference the in page data.
There should be a button in the top of your XSLT editor for inserting 'value-of' items. Click this and you should see a drop-down of pre-values. Select one of these and 'insert' and it should build the XSLT for you.
Assuming your code above is really doing what you want it to apart from bringing the page data in, your XSLT for that will be very simple. Something like:
<xsl:value-of select="column1"/>
Where 'column1' is the alias of the content property on your doctype.
It's really useful to view the XML that Umbraco has for the published data, this file is named umbraco.config and is held in the App_Data directory (4.5 and upwards)
Reading child page data from Home page
Hi,
Sorry but a complete newbie to Umbraco and xslt. I have a number of pages which sit under the Home page and some of these (Sale pages) also have descendants. I want to present a date (called auction date) from the first one of these on the home page. The following code works fine to get the child page title but I can't see how to reference the in page data.
<xsl:param name="currentPage"/>
<xsl:variable name="level" select="2"/>
<xsl:variable name="pageRoot" select="$currentPage/Sale [@nodeName='Auctions']" />
<xsl:template match="/">
<xsl:for-each select="$pageRoot/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<xsl:if test="position()=1">
<h2>
<xsl:value-of select="umbraco.library:FormatDateTime(./data[@alias='auctionDate'], 'ddd d MMM yyyy')"/>
</h2>
</xsl:if>
</xsl:for-each>
</xsl:template>
What do I actually need in the 'value-of' statement?
Sorry to be thick but I'm waiting for my xslt book to arrive but I'm still getting pressure to make things work.
Thanks
Hi Roger,
There should be a button in the top of your XSLT editor for inserting 'value-of' items. Click this and you should see a drop-down of pre-values. Select one of these and 'insert' and it should build the XSLT for you.
Assuming your code above is really doing what you want it to apart from bringing the page data in, your XSLT for that will be very simple. Something like:
Where 'column1' is the alias of the content property on your doctype.
HTH
You are absolutely spot on, thank you. I've got bound up reading fragments of xsly syntax in the wiki and didn't even look in those buttons.
thanks again
Hi Roger,
Firstly, welcome to the forum!
Hope I can help you out.
To get reference to a property on the home page you can use this (Umbraco version >= 4.5)
<xsl:value-of select="$currentPage/ancestor-or-self::root/node/Auctions"/>
The XML schema of Umbraco changed recently at version 4.5, it seems like you are mixing up these schemas, some differences are outlined here http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/no-more-@nodetypealias
It's really useful to view the XML that Umbraco has for the published data, this file is named umbraco.config and is held in the App_Data directory (4.5 and upwards)
Rich
I was a little late on the button, hope my posts helps you somewhat any how.
Rich
Thanks Rich, I'll also change my select syntax as well. :-)
is working on a reply...