This article explains how you can nest macros within the XSLT macro.
XML code to add nested macros
To add nested macros in the XSLT macro, add the XML code in the following format to the XML file to be displayed:
<ac:macro> <xsl:attribute name="ac:name">expand</xsl:attribute> <ac:parameter> <xsl:attribute name="ac:name">title</xsl:attribute> <xsl:value-of select="@name"/> </ac:parameter> <ac:rich-text-body> ...... </ac:rich-text-body> </ac:macro>
The codes mentioned in this article are not meant for general use other than the format mentioned above. The code samples simply illustrate the format and usage of the given format to display the required XML file contents.
Example - Display CD catalog from an XML file
In this example, the requirement is to display a CD catalog with each CD’s title, artist, and country from where the artist originates.
Points to note for this example:
The catalog information is in the form of an XML file and is available at a remote location. Here, a profile is used to access the required file.
See an article about profiles to learn more. Note, the article focuses on data center/server and depicts HTML macro examples. Use the same process to create profiles in cloud and use the Profile parameter in the XSLT macro to access the required file.The XSL definitions are entered directly in the macro editor.
The details entered in the XSLT macro editor are as follows:
The code in the macro editor contains the nested Expand macro used to list out the details such as the title, the artist, and the country where the CD was made.
The content displayed after publishing the page appears as:
If you face any difficulties in using this feature, contact our Support team for help.