Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Simple select question (newbie to xsl+xml) - Selecting from just one node at a time [Thread Next] Re: Simple select question (newbie to xsl+xml) - Selecting from just one node at a timeTo: NULL Date: 2/6/2008 5:14:00 PM conorgaff@g... wrote: > I have several nodes that are identical. They each have a properties > X: > > <nodes> > <node> > <X>one</X> > <X>two</X> > </node> > <node> > <X>aaa</X> > <X>bbb</X> > <node> > </nodes> > > > In my xsl I have > > > <xsl:for-each select="//blah/nodes"> > <nodes> > > </node> > </xsl:for-each> > > > Which is fine for getting each of the nodes out, but problem arises > when I try to take out X properties of the individual node in > transform. > > I keep getting all values of all X properties in each node by using > <xsl:for-each select="//X">: I guess you are looking for relative XPath expressions e.g. <xsl:for-each select="/nodes/node"> <xsl:for-each select="X"> That way the inner for-each selects only the 'X' elements of the 'node' element selected by the outer for-each. So be careful with prefixing XPath expressions with //, that way you are always looking at descendants of the root node. -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
