XQuery Conditional Expressions


Make a list of holdings, ordered by title. For journals, include the editor, and for all other holdings, include the author.

	for $h in //holding
	  return 
		<holding> 
		  $h/title, 
			if $h/@type = "Journal" then
			  $h/editor 
			else 
			  $h/author 
		</holding>