[Home] [By Thread] [By Date] [Recent Entries]
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:for-each select="$myvar"> Date: Wed, 19 Jun 2002 15:57:44 +0200 _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|

Cart



