Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
Got a bit of a struggle here. Im writing a Macro to get the value of a field from the rootpage. Depending on the current page this value can be shown or not.
<xsl:output method="xml" omit-xml-declaration="yes" /><xsl:param name="currentPage"/>
<xsl:variable name="rootpage" select="$currentPage/ancestor-or-self::root" /><xsl:template match="/"><!-- The fun starts here --> <xsl:choose> <xsl:when test="local-name($currentPage)= 'Contactpage'"> <xsl:value-of select="$rootpage/data[@alias='newstext']"/> </xsl:when> <xsl:when test="local-name($currentPage)= 'Otherpages...'"> </xsl:when> <xsl:otherwise> <!-- Some code --> </xsl:otherwise></xsl:choose> </xsl:template></xsl:stylesheet>
For some reason it stay's empty.
Maarten
<xsl:value-of select="$rootpage/newstext"/>
You are using old xslt schema that is used below umbraco v.4.7.
<xsl:value-of select="$rootpage/newstext"/> should work for it.
The new schema came in before 4.7 - Maybe 4.5 from memory.
Mmm strange,
I replaced my entry with <xsl:value-of select="$rootpage/newstext"/> but still empty.
Just in case i added some random text too:
<xsl:when test="local-name($currentPage)= 'Contactpage'"> <xsl:value-of select="$rootpage/newstext"/> <p> Hello </p> </xsl:when> The value returns empty but the text 'Hello' is present in the source.Maarten
The value returns empty but the text 'Hello' is present in the source.
What does your newstext holds?
What datatype is it?
Cross check you have placed the content and published it.
newstext datatype is richtext and yes, the content on the homepage is publised.
I've been experimenting a bit to be sure:
The following does work but is not very nice since you need a 'hard' ID that refers to the rootpage
<xsl:value-of select="umbraco.library:GetXmlNodeById('1068')/newstext" disable-output-escaping="yes"/>
I think the issue may be with $currentPage/ancestor-or-self::root
If you're after your homepage, I don't think that will be your homepage, but instead, the item above your homepage.
Maybe try $currentPage/ancestor-or-self::*[@isDoc and @level = 1]
I could be wrong though.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
getting a value of the root page in all levels UMBRACO 4.7
Hi,
Got a bit of a struggle here. Im writing a Macro to get the value of a field from the rootpage. Depending on the current page this value can be shown or not.
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
For some reason it stay's empty.
Maarten
You are using old xslt schema that is used below umbraco v.4.7.
<xsl:value-of select="$rootpage/newstext"/> should work for it.
The new schema came in before 4.7 - Maybe 4.5 from memory.
Mmm strange,
I replaced my entry with <xsl:value-of select="$rootpage/newstext"/> but still empty.
Just in case i added some random text too:
What does your newstext holds?
What datatype is it?
Cross check you have placed the content and published it.
newstext datatype is richtext and yes, the content on the homepage is publised.
I've been experimenting a bit to be sure:
The following does work but is not very nice since you need a 'hard' ID that refers to the rootpage
<xsl:value-of select="umbraco.library:GetXmlNodeById('1068')/newstext" disable-output-escaping="yes"/>
I think the issue may be with $currentPage/ancestor-or-self::root
If you're after your homepage, I don't think that will be your homepage, but instead, the item above your homepage.
Maybe try $currentPage/ancestor-or-self::*[@isDoc and @level = 1]
I could be wrong though.
is working on a reply...