Subject: Re: [xsl] XPath statement required pls From: Adam Turoff <ziggy@xxxxxxxxx> Date: Mon, 13 Aug 2001 14:02:00 -0400 |
On Mon, Aug 13, 2001 at 01:44:04PM -0400, Sanjay Pandey/Towers Perrin wrote: > > Hi, > > I have XML file as follows: > <parameter name = "one"> > <level1> > <level2 name = "a"> > <level3> > <theField>something</theField> > </level3> > </level2> > <level2 name = "b"> > <level3> > <theField>something</theField> > </level3> > </level2> > <level2 name = "c"> > <level3> > <theField>something</theField> > </level3> > </level2> > </level1> > </parameter> > > <parameter name = "two"> > </parameter> > > My problem is as follows: > 1. I need to get all the occurrances of <theField> (... and that is fine, I > am getting those, using XPathAPI, into a NodeIterator) //theField Find all occurances of <theField>. > 2. For each field I want to get the nearest Attribute value, so that I can > uniquely identify <theField>. Is there a generic way to get the > nearest Attribute value? In my case it is not always true that the > attribute for a field (in this case <theField>) is at a particular level > (in the current case, I can get the attribute value by going w levels > up, ... but then that is what I am trying to find if there is generic > way to find the nearest Attribute value for a particular field) //theField/ancestor::*[@name][1]/@name Find all occurrances of <theField>, then the first ancestor with a name attribute, then that name attribute. HTH, Z. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XPath statement required pls, Sanjay Pandey/Towers | Thread | Re: [xsl] XPath statement required , Sanjay Pandey/Towers |
[xsl] XPath statement required pls, Sanjay Pandey/Towers | Date | Re: [xsl] n-value of preceding lb-e, Thomas B. Passin |
Month |