Questions related to XPath 2.0

Murali Mani <[email protected]>
Newsgroups gmane.comp.web.query-languages
Message-ID <[email protected]>

I had 3 questions related to XPath 2.0

1. What is the rationale behind including for expressions, conditional
expressions etc in XPath 2.0? From a glance, I would have preferred if
XPath only allowed us to specify patterns, and XPath engine will return
all the occurrences of the pattern (say in document order etc).. I might
have preferred if these things were in XQuery/XSLT and not in XPath..

But I believe there should have been a rationale for this? Can you
summarize/point me to that?

2. I was looking at fn:id (string) and fn:idref (string). How do I use it,
say if I get a list of values of idref attributes. An example that I may
think of is a schema (rough DTD) like:

<!ATTLIST Professor (pname, office, pid)>
<!ATTLIST Student (sname, major, advisor)>

advisor is an IDREF attribute, pid is ID attribute.

I want to do something like:
Student [@major='CS']/@advisor->Professor/@pname

Basically names of advisors of CS majors. How do I write in XPath, can I
do it w/o using ForExpr

3. Another thing I noted is: When I look up fn:id, the spec does not
mention whether the result will contain duplicate nodes. I see that the
spec mentions for fn:idref that the result will not contain duplicate
nodes. I hope this was just overlooked?

thanks, and best,
murali.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.