Subject: RE: [xsl] <xsl:for-each select="$myvar"> From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx> Date: Wed, 19 Jun 2002 15:17:14 +0000 |
Is it possible that Bill could use an xsl:parameter to get a variable input from outside
From: "Smith, Graham" <Graham.Smith@xxxxxxxxxx> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: "'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'" <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Subject: RE: [xsl] <xsl:for-each select="$myvar"> Date: Wed, 19 Jun 2002 10:52:27 -0400
Vasu,
Is it possible that Bill could use an xsl:parameter to get a
variable input from outside, or do xsl:parameters only work at nested levels
WITHIN the xsl...?
Graham.
> Graham Smith (IPC 692)
> International Financial Systems
> Pfizer Limited, Ramsgate Road, Sandwich
> Kent, England
> CT13 9NJ
>
> Tel: +44 1304 646054
> Fax: +44 1304 655711
> e-mail: Graham.Smith@xxxxxxxxxx
>
>
> LEGAL NOTICE
>
> Unless expressly stated otherwise, this message is confidential and may be
privileged. It is intended for the addressee(s) only. Access to this e-mail
by anyone else is unauthorised. If you are not an addressee, any disclosure
or copying of the contents of this e-mail or any action taken (or not taken)
in reliance on it is unauthorised and may be unlawful. If you are not an
addressee, please inform the sender immediately.
>
> Pfizer Limited is registered in England under No. 526209 with its
registered office at Ramsgate Road, Sandwich, Kent CT13 9NJ
>
-----Original Message----- From: Vasu Chakkera [mailto:vasucv@xxxxxxxxxxx] Sent: 19 June 2002 15:20 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] <xsl:for-each select="$myvar">
No!! you can only refer to nodeset in the xsl:for-each... you are tryin to refer to a variable through $myvar .. which is wrong...
if you wanted to do something in the lines of picking up all the items whose
name is "DEC" or what ever, then you may want to try the following.. Your XML: <?xml version="1.0" ?> <collection> <intro>My Computer Collection</intro> <item> <manufacturer>DEC</manufacturer> <model>MicroVAX 3100-30</model> <opsys>OpenVMS 5.5-2</opsys> <cpu>25MHz</cpu> <memory>unknown</memory> <enclosure>BA42-B</enclosure> <notes>none</notes> </item> <item> <manufacturer>COMPAQ</manufacturer> <model>COMPAQ II</model> <opsys>OpenVMS 5.5-2</opsys> <cpu>KA630</cpu> <memory>unknown</memory> <enclosure>BA23 rackmount</enclosure> <notes>This is my first VAX which I hope to get running with OSU (=DECthreads)</notes> </item> </collection>
XSL:
( to select the model of an item with the manufacturer as DEC or COmpaq or whichever u choose ... i have only selected the Model... you may select which ever u want to)
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:for-each select="/collection/item[manufacturer = 'DEC']"> <xsl:value-of select="model"/> <br></br> </xsl:for-each> </xsl:template> </xsl:stylesheet>
In the above style sheet you are specific about the manufacturer value.. you
can change that value to 'Compaq' to get all the items whose manufacturer is
Compaq..
HTH ( if this is what you want )
>From: "William S." <wstan@xxxxxxxxx> >Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx >To: xsl-list <XSL-List@xxxxxxxxxxxxxxxxxxxxxx> >Subject: [xsl] <xsl:for-each select="$myvar"> >Date: Wed, 19 Jun 2002 15:57:44 +0200 > >I am trying to do the operation as described in the subject >line but am getting "Sablotron Error (48): >expression is not a node set". > >The value of the variable is "item" which is the same as if >I used "<xsl:for-each select="item">" So why >doesnt this work? > >What I had hoped to do with this is allow the user to >have control what is displayed in an XML file. For >instance with the XML file below I would like to display >only DEC machines, or only Compaq, or only IBM. > >XML file sample... > ><?xml version="1.0" ?> > ><collection> > <intro>My Computer Collection</intro> ><item> > <manufacturer>DEC</manufacturer> > <model>MicroVAX 3100-30</model> > <opsys>OpenVMS 5.5-2</opsys> > <cpu>25MHz</cpu> > <memory>unknown</memory> > <enclosure>BA42-B</enclosure> > <notes>none</notes> ></item> > ><item> > <manufacturer>DEC</manufacturer> > <model>MicroVAX II</model> > <opsys>OpenVMS 5.5-2</opsys> > <cpu>KA630</cpu> > <memory>unknown</memory> > <enclosure>BA23 rackmount</enclosure> > <notes>This is my first VAX which I hope to get running > with OSU (=DECthreads)</notes> ></item> > . . . . and so on... > >By the way, I am not too sure the XML file is formatted very >well. This is just a test setup. Can anyone suggest a better way to >do it? I can't seem to see anything in the archives. I am >using php with Sablotron and doing this all on the server end. > >Thank you, >-- >Bill >Amsterdam, NL > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
_________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.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 -> |
---|---|---|
Re: [xsl] <xsl:for-each select="$my, William S. | Thread | [xsl] Processing the XSL piping one, Dhruvraj Singh |
RE: [xsl] Hello World, Andrew Welch | Date | Re: [xsl] <xsl:for-each select="$my, James Fuller |
Month |