Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In Umbraco you can have what are called recursive values. This are basically page values which look up the node hierachy until it filnds a value.</p> <p>These can be passed to macros as well.</p> <p>So in your case assuming your macro is called "charityTotaliser" you could use the following macro call:</p> <pre><code>&lt;umbraco:macro alias="charityTotaliser" ammount="[$FundraisingCurrentAmount]" goal="[$FundraisingGoal]"runat="server"/&gt; </code></pre> <p>The $ indicates that the value is recursive.</p> <p>The XSLT would look something like this (not tested just an example):</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE xsl:Stylesheet [ &lt;!ENTITY nbsp "&amp;#x00A0;"&gt; ]&gt; &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" exclude-result-prefixes="msxml umbraco.library Exslt.ExsltMath"&gt; &lt;xsl:output method="xml" omit-xml-declaration="yes"/&gt; &lt;xsl:param name="currentPage"/&gt; &lt;!-- Macro parameters --&gt; &lt;xsl:variable name="FundraisingCurrentAmount" select="/macro/FundraisingCurrentAmount"/&gt; &lt;xsl:variable name="FundraisingGoal" select="/macro/FundraisingGoal"/&gt; &lt;xsl:template match="/"&gt; &lt;xsl:value-of select="$FundraisingCurrentAmount div $FundraisingGoal * 100"/&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>If requied you can also specify fallback values to be passed (in case the recursive value cannot be found):</p> <pre><code>&lt;umbraco:macro alias="charityTotaliser" ammount="[$FundraisingCurrentAmount], [#FallBackAmmount], 1234" goal="[$FundraisingGoal]"runat="server"/&gt; </code></pre> <p>For more information on macro parameters you can read this <a href="http://our.umbraco.org/wiki/reference/templates/umbracomacro-element/macro-parameters/advanced-macro-parameter-syntax" rel="nofollow noreferrer">documentation</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload