This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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@kobayashi.ca]
> Sent:	Thursday, March 22, 2001 10:59 AM
> To:	xsl-list@lists.mulberrytech.com
> Subject:	RE: [xsl] 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@lists.mulberrytech.com
> > [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of James J
> > Nampalam
> > Sent: March 21, 2001 11:06 PM
> > To: xsl-list@lists.mulberrytech.com
> > Subject: [xsl] 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]