This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Passing Variable into a child template


Hi,

This should be a simple solution but I haven't been able to find any 
solutions in the archive...

Basically I want to share a common value within a child template.

<MenuList>
	<ServerName>myserver</ServerName>

	<MenuItem>
		<MenuName>Menu 1</MenuName>
		<MenuUrl>doc1.html</MenuUrl>
	</MenuItem>
	<MenuItem>
		<MenuName>Menu 1</MenuName>
		<MenuUrl>doc2.html</MenuUrl>
	</MenuItem>
</MenuList>

So that I can use it like:
<xsl:template match="MenuItem">
  <xsl:param name="theServer"/>
   ...
  <xsl:attribute name="src">
     http://<xsl:value-of-select="$theServer"/>
  </xsl:attribute>
   ...
</xsl:template>

I have tried variables with call-templates, but that doesn't seem to work.  
I have also tried apply-templates unsuccessfully:
<xsl:variable name="server-in-parent">
  <xsl:apply-templates select="MenuItem">
    <xsl:with-param name="thisServer" select="ServerName"/>
  </xsl:apply-templates>
</xsl:variable>

Can you help?

Thanks,
Sia.

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]