Is is possible to get the page name based on this, so for example say this node is 1024, currently i ouput this number but what i want to do is output the name of the page, so Homepage for example?
Also i want to set up a link to this page based on this node id, i select the page using a content picker, how can i build the a link using this node id?
to check whether info is available from that property. If you don't, you'l get an error when saving the xslt as that property value is not available until runtime.
Key is to use the NiceUrl() xslt extension method which takes the id of the node for which to build the link
Cheers Dirk thats brilliant, just the job! One final question is it possible to have some sort of recursive feature in xslt, i know in templates i've used recursive="true" so that umbraco will look at the parent for existing data, but how can you do this in xslt? Basically i have used the repeatable custom content to create a load of quick links at the bottom of a page and i want these to exist on every page not just the homepage!
Hi unforutanely neither of those two solutions seems to work? I've attached my code, so maybe you could have a quick look? As you can see i've tried to apply the "ancestor-or-self::node" to the repeatble content variable, however the repeated content is only appearing on the hompage still, not any of the others. Maybe i'm missing something very obvious, but i can't see it yet!
<!-- Input the repeatable custom contents property alias here --> <xsl:variable name="propertyAlias" select="string('quickLinks')"/>
<xsl:template match="/">
<!-- The fun starts here --> <xsl:if test="$currentPage/data [@alias = $propertyAlias]/items/item">
Get page name from node id
Hi all wonder if someone can help, i'm getting the node id of a page, using the following piece of xslt:
<xsl:value-of select="./data [@alias = 'quickLinksContent']" disable-output-escaping="yes"/>
Is is possible to get the page name based on this, so for example say this node is 1024, currently i ouput this number but what i want to do is output the name of the page, so Homepage for example?
Also i want to set up a link to this page based on this node id, i select the page using a content picker, how can i build the a link using this node id?
Many Thanks
Vince
vince,
use
and surround this with an
to check whether info is available from that property. If you don't, you'l get an error when saving the xslt as that property value is not available until runtime.
Key is to use the NiceUrl() xslt extension method which takes the id of the node for which to build the link
If you need the name of the page, use
Hope this helps.
Regards,
/Dirk
Cheers Dirk thats brilliant, just the job! One final question is it possible to have some sort of recursive feature in xslt, i know in templates i've used recursive="true" so that umbraco will look at the parent for existing data, but how can you do this in xslt? Basically i have used the repeatable custom content to create a load of quick links at the bottom of a page and i want these to exist on every page not just the homepage!
Maybe this could help, or pass a recursive property to your xslt using this syntax:
Hope this helps.
Regards,
/Dirk
Hi unforutanely neither of those two solutions seems to work? I've attached my code, so maybe you could have a quick look? As you can see i've tried to apply the "ancestor-or-self::node" to the repeatble content variable, however the repeated content is only appearing on the hompage still, not any of the others. Maybe i'm missing something very obvious, but i can't see it yet!
<!-- Input the repeatable custom contents property alias here -->
<xsl:variable name="propertyAlias" select="string('quickLinks')"/>
<xsl:template match="/">
<!-- The fun starts here -->
<xsl:if test="$currentPage/data [@alias = $propertyAlias]/items/item">
<ul class="quickLink1">
<xsl:for-each select="$currentPage/ancestor-or-self::node/data[@alias= $propertyAlias]/items/item">
<li><a href="{umbraco.library:NiceUrl(./data [@alias = 'quickLinksContent1'])}"><xsl:value-of select="umbraco.library:GetXmlNodeById(./data [@alias = 'quickLinksContent1'])/@nodeName" /></a></li>
</xsl:for-each>
</ul>
<ul class="quickLink2">
<xsl:for-each select="$currentPage/ancestor-or-self::node/data[@alias= $propertyAlias]/items/item">
<li><a href="{umbraco.library:NiceUrl(./data [@alias = 'quickLinksContent2'])}"><xsl:value-of select="umbraco.library:GetXmlNodeById(./data [@alias = 'quickLinksContent2'])/@nodeName" /></a></li>
</xsl:for-each>
</ul>
<ul class="quickLink3">
<xsl:for-each select="$currentPage/ancestor-or-self::node/data[@alias= $propertyAlias]/items/item">
<li><a href="{umbraco.library:NiceUrl(./data [@alias = 'quickLinksContent3'])}"><xsl:value-of select="umbraco.library:GetXmlNodeById(./data [@alias = 'quickLinksContent3'])/@nodeName" /></a></li>
</xsl:for-each>
</ul>
<ul class="quickLink4">
<xsl:for-each select="$currentPage/ancestor-or-self::node/data[@alias= $propertyAlias]/items/item">
<li><a href="{umbraco.library:NiceUrl(./data [@alias = 'quickLinksContent4'])}"><xsl:value-of select="umbraco.library:GetXmlNodeById(./data [@alias = 'quickLinksContent4'])/@nodeName" /></a></li>
</xsl:for-each>
</ul>
<ul class="quickLink5">
<xsl:for-each select="$currentPage/ancestor-or-self::node/data[@alias= $propertyAlias]/items/item">
<li><a href="{umbraco.library:NiceUrl(./data [@alias = 'quickLinksContent5'])}"><xsl:value-of select="umbraco.library:GetXmlNodeById(./data [@alias = 'quickLinksContent5'])/@nodeName" /></a></li>
</xsl:for-each>
</ul>
<ul class="quickLink6">
<xsl:for-each select="$currentPage/ancestor-or-self::node/data[@alias= $propertyAlias]/items/items">
<li><a href="{umbraco.library:NiceUrl(./data [@alias = 'quickLinksContent5'])}"><xsl:value-of select="umbraco.library:GetXmlNodeById(./data [@alias = 'quickLinksContent6'])/@nodeName" /></a></li>
</xsl:for-each>
</ul>
<!-- Live Editing support for related links. -->
<xsl:value-of select="umbraco.library:Item($currentPage/@id,$propertyAlias,'')" />
</xsl:if>
Solved it, i really did miss something very obvious!!
is working on a reply...