[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Using XPath expressions in modes

Subject: RE: Using XPath expressions in modes
From: Meltem Kogelbauer <meltem.kogelbauer@xxxxxxxxxxxxxxxxxx>
Date: Tue, 24 Apr 2001 18:00:40 +0100
xpath modes
<xsl:param name="mode"/>
should be after 
<xsl:template match="page">

like -----
<xsl:template match="page">
<xsl:param name="mode"/>


Meltem



-----Original Message-----
From: William Bagby [mailto:williamb@xxxxxxxxx]
Sent: 24 April 2001 4:54 PM
To: XSL Mailing List (E-mail)
Subject:  Using XPath expressions in modes


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:

XML-----------------------------------------


<page>
...
	<category-list>
		<category>...</category>
		<category>...</category>
		<category>...</category>
		<category>...</category>
		<category>...</category>
	</category-list>
...
</page>

XSL------------------------------------------

<xsl:param name="mode"/>

<xsl:template match="page">

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

</xsl:template>

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

<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
select="."/></option>
	  </xsl:for-each>
	</select>
	<input type="submit"/>
	</form>
</xsl:template>

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.

William.

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

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.