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

xsl:param problem

Subject: xsl:param problem
From: "Anand Jayaraman" <ajayaraman@xxxxxxxxx>
Date: Thu, 9 Aug 2001 07:08:49 -0400
anand jayaraman
Hi All,
I need some help in the following:

I'm trying to create 2 drop-down boxes, one selecting distinct month, and
the other selecting distinct days for a given month from the previous
drop-down box. Hope it is clear so far.

My XML file looks like:
<page>
   <Audits>
      <Audit AuditID="694" Year="2001">
         <Day>15</Day>
         <Month>JUL</Month>
         <SourceFile>15Jul2001.01Aug20011650</SourceFile>
      </Audit>
      <Audit AuditID="705" Year="2001">
         <Day>18</Day>
         <Month>AUG</Month>
         <SourceFile>18Aug2001.02Aug20011921</SourceFile>
      </Audit>
      <Audit AuditID="739" Year="2001">
         <Day>18</Day>
         <Month>JUL</Month>
         <SourceFile>18Jul2001.04Aug20011612</SourceFile>
      </Audit>
   </Audits>
</page>


My desired output should be:
Month Dropdown = JUL (selected), AUG
Days Dropdown for 'JUL' = 15, 18

Below is my version of XSL file. I'm able to create a drop-down for distinct
months. But, am not able to get the distinct days for the first month, in
this case 'JUL'. Something is not correct with the way I'm passing
parameters.

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" />

   <xsl:key name="mon-index" match="page/Audits/Audit" use="Month"/>
   <xsl:param name="monthname" />

   <xsl:template match="/">
      <FORM NAME="blank_form">
         <xsl:apply-templates select="page/Audits"/>
      </FORM>
   </xsl:template>

   <xsl:template match="page/Audits">

      <SELECT>
         <xsl:attribute name="name">
            <xsl:value-of select="'cycleMonth'"/>
         </xsl:attribute>

         <OPTION VALUE="cycleMonth">--MONTH--</OPTION>
         <xsl:for-each
select="Audit/Month[generate-id(.)=generate-id(key('mon-index',.)[1]/Month)]
">
            <OPTION>
               <xsl:sort select="."/>
               <xsl:with-param name="monthname" >
                  <xsl:value-of select="."/>
               </xsl:with-param>
               <xsl:attribute name="value">
                  <xsl:value-of select="."/>
               </xsl:attribute>
               <xsl:value-of select="."/>
            </OPTION>
         </xsl:for-each>
      </SELECT>

      <SELECT>
         <xsl:attribute name="name">
            <xsl:value-of select="'cycleDay'"/>
         </xsl:attribute>

         <OPTION VALUE="cycleDay">--DAY--</OPTION>
         <xsl:param name="monthname"/>
         <xsl:for-each select="key('mon-index',$monthname)">
            <OPTION>
               <xsl:sort select="Month"/>
               <xsl:attribute name="value">
                  <xsl:value-of select="Day"/>
               </xsl:attribute>
               <xsl:value-of select="Day"/>
            </OPTION>
         </xsl:for-each>
      </SELECT>

   </xsl:template>

</xsl:stylesheet>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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


Current Thread
  • xsl:param problem
    • Anand Jayaraman - Thu, 9 Aug 2001 07:10:22 -0400 (EDT) <=
      • <Possible follow-ups>
      • Hewko, Doug - Thu, 9 Aug 2001 08:34:59 -0400 (EDT)

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.