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]
Other format: [Raw text]

Re: Re: Getting the XPath of a node


Dimitre Novatchev wrote:
> This will produce an XPath expression, which (while covering the node)
> is not unique and probably returns some other nodes in addition to the
> current node.
> 
> An XPath expression, which evaluates to a single node, must include
> predicates showing the positions of the elements forming the path.

Yes, you're right. That's what I get for posting at 4:00 in the morning.

However -- not that I was shooting for this -- he didn't give uniqueness as a
criteria, did he? :) He didn't say what he wanted these paths for. I guess as
a learning tool? Hopefully he's not going to try to put them in variables and
evaluate them without extensions. Anyway, it may still be valuable, if he sees
that input like this

<foo>
  <Person id="1">
    <Company>Netscape</Company>
  </Person>
  <Person id="2">
    <Company>Microsoft</Company>
  </Person>
  <Person id="3">
    <Company>Sun</Company>
  </Person>
</foo>

...produces output like this

1: /foo/Person/Company
2: /foo/Person/Company
3: /foo/Person/Company

it might make him think, "aha! /foo/Person/Company picks up all 3!" which
might be what he wanted. Then again, it might confuse him more if he's
wondering why xsl:value-of select="/foo/Person/Company" generates just 
"Netscape". Oh well.

   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

 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]