Create a new xquery paste the following code and save the query in
c:\Program Files\Stylus Studio 2006 Release 3 XML Enterprise Edition\examples\simpleMappings
declare variable $d := doc("books.xml");
for $subject in distinct-values($d/books/book/subject)
return concat($subject, ' ',count($d/books/book[subject=$subject]))
Cool, that worked. But why is it necessary? All the namespaces are defined in the xml itself. Seems like I would only need this if I wanted a short cut prefix that was different than the ones in the data.
I realize you didn't write the XSLT/XQuery standards - but it isn't that just crazy? Did they have some logical reason for making that decision - which makes for bulkier code, a lot of copy/paste, especially since the the syntax in XQuery for defining the prefixes is slightly different from that of XML.
This would be a great opportunity for you to provide a neat "import" feature. Click some button, and it would import all namespaces from XML input into XQuery declare statements.