From: Hungerburg <pc...@my...> - 2014-06-30 13:42:52
|
Am 2014-06-30 15:21, schrieb wol...@ex...: >> I am using the following XQuery code for selecting all .html documents >> within a collection of exist-db. The script should create an XML >> document (serialized as JSON) with document URI and title (which is >> stored as the first H1 element). However the the element remains empty. >> > Most likely h1 is not the root element of the document, but further down > the tree? If yes, you would need to use $doc//h1/text() to find it. Likely, a namespace is missing too! > xquery version "3.0"; > declare default element namespace "http://www.w3.org/1999/xhtml"; > > <result> { > let $data-collection := '/db/some/where' > for $doc in collection($data-collection) > where ends-with(base-uri($doc), '.html') > return > <item> > <url>{base-uri($doc)}</url> > {$doc//title} > </item> > } > </result> -- peter |