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

How to generate different name using the same rule.

Subject: How to generate different name using the same rule.
From: sivaji <sivaji@xxxxxxxxx>
Date: Wed, 14 Jun 2000 16:17:50 -0700
same product different name
HI All,

I am in a seriuos problem , I have template rule which will be called from
variuos rule , the problem I face is for the same rule being called it should
generate different names as per sequence , to be precise

In the below xsl rule condition is called by  locations & products when it is
called by locations the select should have a name like loc-qual-1 , loc-qual-2
, etc..
the same when called by products it should generate
prod-qual-1, prod-qual-2 etc..

thanks on advance.
sivaji


here is the xml :

<restrictions>
<prodlist>
<products>
prod1
</products>
<products>
prod2
</products>
<products>
prod3
</products>
<products>
prod4
</products>
</prodlist>
<locations>
 <condition>
  <places>
   <place>
   subtree
   </place>
   <place>
   node
   </place>
   <place>
   childof
   </place>
  </places>
  <qualifiers>
   <qualifier>
   is
   </qualifier>
   <qualifier>
   has
   </qualifier>
   <qualifier>
   has not
   </qualifier>
  </qualifiers>
 </condition>
 <condition>
  <places>
   <place>
   subtree
   </place>
   <place>
   node
   </place>
   <place>
   childof
   </place>
  </places>
  <qualifiers>
   <qualifier>
   is
   </qualifier>
   <qualifier>
   has
   </qualifier>
   <qualifier>
   has not
   </qualifier>
  </qualifiers>
 </condition>
</locations>
<products>
 <condition>
  <places>
   <place>
   subtree
   </place>
   <place>
   node
   </place>
   <place>
   childof
   </place>
  </places>
  <qualifiers>
   <qualifier>
   is
   </qualifier>
   <qualifier>
   has
   </qualifier>
   <qualifier>
   has not
   </qualifier>
  </qualifiers>
 </condition>
 <condition>
  <places>
   <place>
   subtree
   </place>
   <place>
   node
   </place>
   <place>
   childof
   </place>
  </places>
  <qualifiers>
   <qualifier>
   is
   </qualifier>
   <qualifier>
   has
   </qualifier>
   <qualifier>
   has not
   </qualifier>
  </qualifiers>
 </condition>
</products>
</restrictions>


and the xsl is

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output method = "html">
<xsl:template match="/">
<html>
<head></head>
<title>Panopticon2</title><LINK rel="stylesheet" href="report.css"
type="text/css" />
<body bgcolor="#FFFFFF" text="#000000" link="#CC3333" vlink="#CC3333"
alink="#FFFFFF">
<p/><br/>
<a href="/"><img src="logo150.gif" width="150" height="21" vspace="2"
class="PageHeader" border="0" /></a>
<p/>
<h3><b><center>Product Display Restrictions</center></b></h3>
<p/>
<form action="nothing">
<xsl:apply-templates />
<br/><br/><p/>
<hr/><br/>
<center>
<input type="button" value="Change Rule" />
</center>
</form>
</body>
</html>
</xsl:template>

<xsl:template match="prodlist">
<center>
<!--<h3>Rules:</h3><br/>-->
<select name="products" size = "5" >
<xsl:for-each select="products" >
<option value = "{normalize-space()}">
 <xsl:value-of select="."/>
</option>
</xsl:for-each>
</select>
<br/><br/>
<input type="button" value="Add" />
<input type="button" value="Delete" />
</center>
</xsl:template>

<xsl:template match="locations">
<p/>
<hr/>
<table>
<tr>
<td><b>Within locations matching</b></td>
<td><input type="radio" name="loc" value="any" /><b><i> any</i></b></td>
<td><input type="radio" name="loc" value="any"/><b><i> all</i></b></td>
<td><b> of the following: </b></td>
</tr>
</table>
<center>
<xsl:apply-templates />
<input type="reset" value="Add Condition" />
<input type="button" value="View Selected" />
</center>
</xsl:template>

<xsl:template match="products">
<p/>
<hr/>
<table>
<tr>
<td><b>show prodcuts matching</b></td>
<td><input type="radio" name="loc" value="any" /><b><i> any</i></b></td>
<td><input type="radio" name="loc" value="any"/><b><i> all</i></b></td>
<td><b> of the following: </b></td>
</tr>
</table>
<center>
<xsl:apply-templates />
<input type="reset" value="Add Condition" />
<input type="button" value="View Selected" />
</center>
</xsl:template>


<xsl:template match ="condition">
<table border="0">
<tr><td>
<select name="places">
<xsl:for-each select="places/place" >
<option value = "{normalize-space()}">
<xsl:value-of select="."/>
</option>
</xsl:for-each>
</select>
</td><td>
<select name="qualifiers" >
<xsl:for-each select="qualifiers/qualifier" >
<option value = "{normalize-space()}">
<xsl:value-of select="."/>
</option>
</xsl:for-each>
</select>
</td> <td> <input type="text" size="20" value="Flowers Cards" name="text"
/></td>
<td><input type="button" value="Browse" /></td>
<td><input type="button" value="Delete" /></td>
</tr></table>
</xsl:template>
</xsl:output>
</xsl:stylesheet>









 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.