Name

<xsl:arg>

Synopsis

<xsl:arg name= string default= value “/>

Description

Defines an argument and default value, which can be used when invoking a macro. For example:

<xsl:macro name="mymacro">
  <xsl:macro-arg name="format" default="A. "/>
  <xsl:number format="{arg(format)}"/>
  <xsl:contents/>
</xsl:macro>
<xsl:template match="toc/entry">
  <xsl:invoke macro="mymacro">
    <xsl:arg name="format" value="1. "/>
    <xsl:apply-templates/>
  </xsl:invoke>
</xsl:template>

This passes the value ”1. <“> into the XSL macro mymacro when invoking it.

Get XML Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.