Subject: RE: [xsl] xsl:param problem From: "Hewko, Doug" <Doug.Hewko@xxxxxxxxxxxxxxx> Date: Thu, 9 Aug 2001 08:32:15 -0400 |
Maybe someone can answer this. I copied the code and tried to test it in Cocoon2. Unfortunately, I am getting lots of error in it. For example, Cocoon2 does not like "select='.'", nor does it like the <xsl:sort> statement on line 25. Here is my cocoon sitemap entry: <map:match pattern="test.html"> <map:generate src="testing/test.xml"/> <map:transform src="testing/test.xsl"/> <map:serialize type="html"/> </map:match> I have every confidence that I should get some output, at least to what Anand gets. Why the discripency? -----Original Message----- From: Anand Jayaraman [mailto:ajayaraman@xxxxxxxxx] Sent: August 9, 2001 7:09 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] xsl:param problem 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 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] xsl:param problem, Anand Jayaraman | Thread | [xsl] a doubt regarding presence of, Lakshmi Narayanan K |
[xsl] Calculate mantissa and expone, Mitchell, Edmund | Date | Re: [xsl] Re: Réf.[2]_:_Réf.[2]_:_T, Dimitre Novatchev |
Month |