fn:id and fn:idref
Added by Anonymous almost 20 years ago
Legacy ID: #2965606 Legacy Poster: ffn04 (ffn04)
Hi there, I have the following xml doc: <univ> <dept> <student registration="c1, c2"> <name>Kurt</name> </student> <student registration="c2"> <name>Mary</name> </student> <student registration="c1"> <name>Jane</name> </student> <course cno="c1"> <title>cpsc100</title> </course> <course cno="c2"> <title>cpsc200</title> </course> </dept> <dept> <student registration="c3"> <name>Frank</name> </student> <student registration="c1, c3"> <name>Joe Doe</name> </student> <student registration="c2"> <name>Paul</name> </student> <course cno="c3"> <title>chin300</title> </course> <course cno="c4"> <title>chin400</title> </course> <course cno="c5"> <title>chin500</title> </course> </dept> </univ> I would like to retrieve the titles of the courses that "Joe Doe" is taking. I'm using the following query: for $s in doc("jd.xml")/univ/dept where $s/student/name = "Joe Doe" return $s/course/idref(@registration) Saxon doesn't return anything but there are no errors either...could anyone please suggest how I could fix my query? Thank you!
Replies (1)
RE: fn:id and fn:idref - Added by Anonymous almost 20 years ago
Legacy ID: #2965682 Legacy Poster: Michael Kay (mhkay)
Requests for help with XSLT coding, that are not specific to Saxon, would be better addressed to xsl-list at www.mulberrytech.com. The idref() function will return nothing unless your document contains some elements or attributes marked as IDs. To mark them as IDs, you need either a DTD or a schema that describes them as such. (xml:id will also be supported in the next Saxon release.) Michael Kay
Please register to reply