Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling an XML filtered Menu function?

Status
Not open for further replies.

misterpunch

Technical User
Nov 18, 2007
6
CA
I have a dilemma that has brought many late (and fruitless) nights in the past week.

My goal is pretty simple in my opinion: I want to have a standard XSL template (to sort a list of photos and information in a menu frame) and call another template to override it and filter the menu by category. Calling from a button most likely JavaScript.

Now I'm new to XML, but I understand it pretty well. XSL seems pretty straight forward but I only know basic JavaScript.

WHAT IS THE MOST PAINLESS WAY TO DO THIS??

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform">[/URL]
<xsl:output method = "html" encoding="Windows-1252" />

<xsl:template match="/" >
<xsl:param name="navigation" />

<html>
<head>
<link rel="stylesheet" href="klm.css" type="text/css" />
</head>
<body>
<table border="0" bordercolor="#eeeeee" bgcolor="#eeeeee" padding="0" cellpadding="0">
<tr><td colspan="2" align="center"><h2><xsl:value-of select="$active" /></h2></td></tr>
      <xsl:for-each select="gallery/photo">
      <tr>
      <td colspan="2" align="center">
      <a href="{photoInfo/Image/@LARGE}" target="view"><img src="{photoInfo/Image/@THUMB}" border="0"/></a></td></tr>
      <tr>
	<td margin="8">
	<span class="info"> &#160; Model:</span>
	</td>
	<td align="center">
	<span class="info"><xsl:value-of select="photoInfo/model" /></span>
	</td>
	</tr>
      <tr>
	<td>
	<span class="info"> &#160; Makeup:</span>
	</td>
	<td align="center">
	<span class="info"><xsl:value-of select="photoInfo/makeup" /></span>
	</td>
      </tr>
      <tr>
	<td margin="8">
	<span class="info"> &#160; Hair:</span>
	</td>
	<td align="center">
	<span class="info"><xsl:value-of select="photoInfo/hair" /></span>
	</td>
      </tr> 
      </xsl:for-each>  
   </table>
</body>
</html>

</xsl:template >

<xsl:template name="product">
  <xsl:for-each select="gallery/photo[category='Product']">
  </xsl:for-each>
</xsl:template>

<xsl:template name="portrait">
  <xsl:for-each select="gallery/photo[category='Portrait']">
  </xsl:for-each>
</xsl:template>

</xsl:stylesheet>

that's my stylesheet for the following page (very simplified version of the final product)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top