xquery version "1.0"; (: XQuery to format DAWG result2.xml results as xhtml :) declare namespace res="http://www.w3.org/sw/2001/DataAccess/result2#"; declare namespace default="http://www.w3.org/1999/xhtml"; (: How to set serialization parameters? :) (: doctype-system = "-//W3C//DTD XHTML 1.0 Transitional//EN" :) (: doctype-public = "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> :) document { Query Results

Query Results

{ { for $var in //res:dawg-result/res:variables/* return } } { for $result in //res:dawg-result/res:results/* return { for $item in $result/* return } }
{ string($var/@name) }
{ if ($item/@id) then (: blank node value :) text { "nodeID", string($item/@id) } else if ($item/@href) then (: URI value :) { string($item/@href) } else if ($item/@datatype) then (: datatyped literal value :) text { string($item/.), "(datatype", string($item/@datatype), ")" } else if (fn:string-length(string($item)) = 0 ) then (: unbound variable - empty cell :) " " else (: literal value - FIXME, add language :) string($item) }
}