[xsl] Using XPath expressions in modes

Subject: [xsl] Using XPath expressions in modes
From: William Bagby <williamb@xxxxxxxxx>
Date: Tue, 24 Apr 2001 11:54:00 -0400
This seems like a very basic question, but I wasn't able to locate the
answer to this on any FAQs....

I have a list of categories, and I would like it to be displayed differently
based on URL params:




<xsl:param name="mode"/>

<xsl:template match="page">

	<xsl:if test="$mode">
		<xsl:apply-templates select="category-list" mode="$mode"/>
	<xsl:if test="not($mode)">
		<xsl:apply-templates select="category-list" mode="default"/>


<xsl:template match="category-list" mode="default">
	<!-- display as Table -->
	<table border="0" cellpadding="0" cellspacing="0" width="200"
		<xsl:for-each select="category">
			<tr><td><xsl:value-of select="."/></td></tr>

<xsl:template match="category-list" mode="dropdown">
	<!-- display as dropdown list -->
	<form action=".." method="get">
	<select name="cat">
		<xsl:for-each select="category">
			<option value="{.}"><xsl:value-of
	<input type="submit"/>

etc, etc....

Using $mode doesn't seem to work.  Is it even legal?  Or is there a better
way of doing this?

Thanks in advance, and my apologies if this is in the FAQ already.


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

Current Thread