Written by Per Ploug Hansen     For umbraco versions: All

Reference
A look at the mysterious macro parameter types and their syntax.

Contents

Setting up a macro parameter

First let's create a simple xslt script which will have 2 simple parameters, a text string and a contentTree type - to recap: A text type is a simple string and a contentTree type is the xml of a selected node.

Adding the parameters

  1. Create a xslt macro
  2. Look under the "parameters" tab on the macro settings screen.
  3. Create a new parameter the alias "text" name "Text property" and type "text"
  4. Create a second parameter called "contentTree" with the name "Select Node" and the type "contentTree"

step1

Your created parameters should look like the above screen 

 

Writing some basic xslt 

Okey so now we have a macro with some parameters. Lets get these parameters into the xslt. 

Our Xslt code (without the stylesheet info):

<xsl:template match="/">
  <xsl:copy-of select="/macro/text">
  <xsl:copy-of select="/macro/contentTree"> 
</xsl:template>

Inserting the macro on a template

Now insert the macro on a template. You will get prompted by the following screen:
step2

Write some text and pick a node in the content tree by clicking "choose item" - then save. Go take a look at the page in your browser (try viewing the source of the page to see what it actually returns)

Great, you're done with setting up parameters and getting the data into a xslt macro. Let's continue and look at what that data actually look like and how it actually works...