[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Selection Criteria in XSL
Thanks for the help.. Now I am facing another one... the scenario is .. I want to populate values into a page from an XML file. Here I have a condition that only those values should be populated which satisfy a certain criteria.. and the criteria is obtained from a field in the page where I am populating the values. I tried using xsl:variable and xsl:script like... <xsl:variable name="test"> <xsl:eval>test1()</xsl:eval> </xsl:variable> <xsl:script><![CDATA[function test1(){return document.all.fieldname.value}]]></xsl:script> and in selection criteria was .. <xsl:for-each select=".[entrydata[0]/text = '$test']"> ( for XML file please refer to my mail below... ) But I get the error message"xsl:variable keyword may not be used here". Is it due to the fact that my browser does not support xsl:variable... Any ideas please... on getting a variable value.. is it possible to access the JS variables in the xsl documents?? Thanks.. James > -----Original Message----- > From: Brent Kobayashi [SMTP:brent@xxxxxxxxxxxx] > Sent: Thursday, March 22, 2001 10:59 AM > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: RE: Selection Criteria in XSL > > OK, > > I tried this and it seems to work: > (Warning - I'm totally new to this, and my presentation is just as much a > question as it MIGHT be a solution): > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > <xsl:template > match="viewentries/viewentry[entrydata[@columnnumber='1']='Autobiography'] > "> > <xsl:for-each select="entrydata"> > <h3><xsl:value-of select="."/></h3> > </xsl:for-each> > </xsl:template> > > > So my understanding is this: > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > <xsl:template match="viewentries/viewentry"> > > <xsl:for-each > > select="./entrydata[@columnnumber='1']/text='Autobiography'"> > > You are trying to select the specific viewentry node, therefore you would > have: viewentries/viewentry[some criteria] > > Note: With your's, after you piece together the match & the for-each, you > get: viewentries/viewentry/entrydata ... > >> This selects the actual entrydata node. > Also the /text isn't a node, or anything. Maybe if the XML was > formed > <entrydata><text></text></entrydata>? > > Actually, I tried to do this selection in two parts, like yours, ie; > > <xsl:template match="viewentries/viewentry"> > > <xsl:for-each > select=".[entrydata[@columnnumber='1']='Autobiography']"> > > but it definitely did not like this. Maybe someone can offer an > explanation? > > > > I'm using XML Spy v3.5 with MXSML 3.0 > > > > Cheers, > > Brent > http://www.kobayashi.ca/ > http://www.medusacreative.com/ > > > > -----Original Message----- > > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of James J > > Nampalam > > Sent: March 21, 2001 11:06 PM > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > > Subject: Selection Criteria in XSL > > > > > > Hi every one, > > I have a problem which must be a simple one but I am not sure > > how to crack > > it. > > To give a background of the scenario, we are working on Domino > environment > > and are using XML and XSL to populate data into a page. > > > > The XML file is like: > > > > <viewentries> > > <viewentry> > > <entrydata>..</entrydata> > > <entrydata>..</entrydata> > > <entrydata>..</entrydata> > > </viewentry> > > <viewentry> > > <entrydata>..</entrydata> > > <entrydata>..</entrydata> > > <entrydata>..</entrydata> > > </viewentry> > > </viewentries> > > > > the entry data element has an attribute - columnnumber which defines the > > position of the entrydata in the viewentry element. > > > > MY problem is I need to select only those viewentry elements whose 1st > > entrydata elements match a specific value.. > > > > I wrote something like this. > > > > <xsl:template match="viewentries/viewentry"> > > <xsl:for-each > > select="./entrydata[@columnnumber='1']/text='Autobiography'"> > > populate the other values in the viewentry element... > > </xsl:for-each> > > </xsl:template> > > > > I am rookie in XSL. So please help me out.. > > > > Thanks in Advance, > > > > James > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > > > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|