a) That the fn prefix is predefined in the methods to the July 2004 working
draft. If you overwrite it with a later namespace, it will be taken as a
function that we have no knowledge about.
b) That we currently do not implement all functions of the XQuery F&O
library (for a variety of reasons, including stability of the spec). Books
Online provides you with the list of functions that we implement.
I hope this helps.
Michael
"GrasshopperQ" <Grassh...@discussions.microsoft.com> wrote in message
news:048B4EFF-93DF-46F2...@microsoft.com...
> Any use of namespaces within SQL Server 2005 XQueries or Schemas has been
> completely fruitless for me. E.g.
>
> SELECT
> @ValidXML.value('declare namespace
> fn="http://www.w3.org/2005/04/xpath-functions";
> fn:month-from-date(shiftDate)', 'varchar(2)')
>
> consistently produces the following error:
>
> Msg 2395, Level 16, State 1, Procedure HgTimeClock_LoadEntries, Line 40
> XQuery [value()]: There is no function
> '{http://www.w3.org/2005/04/xpath-functions}:month-from-date()'
>
> This is not the only example of a namespace not being used, though I won't
> bore you with the rest.
>
> Can someone PLEASE tell me what I'm missing?
>
> Thanks!
There's still the question of it it means anything at all to put references
to outside (non-SQL Server) namespaces in any XML? E.g. writing an XQuery
such as
'declare namespace func="http://www.w3.org/2005/02/xpath-functions";
hours-from-datetime("2005-01-01T08:00:00Z")'
would be worthless since it really doesn't go out to that namespace to get
those standard XPath Functions.
Is that correct?
Best regards
Michael
"GrasshopperQ" <Grassh...@discussions.microsoft.com> wrote in message
news:AEA1FFB8-72A6-477E...@microsoft.com...
In addition, the URIs can be associated with resources such as a schema
collection, a document, or a function library. However, you need mechanisms
to manage such resources inside the database for a variety of reasons
(stability of metadata and data, security etc).
In SQL Server 2005, we currently only provide schema collections and since
we have external mechanisms to bind them to the data, the XQuery
functionality can pick them up. However, even though we now have schema
namespace URIs implicitly made available, we still need a way to bind the
prefixes to be able to refer to the types, elements and attributes defined
in the schema. That's why you still need the namespace declaration syntax.
For example, if you define a schema collection SC that contains a schema
with the target namespace http://example.com and a user-defined atomic type
hatSize that derives from xs:integer, you want to be able to write XQueries
such as
declare namespace f = "http://example.com";
f:hatSize(6) (:casts 6 to an instance of hatSize :)
declare namespace f= "http://example.com";
data(/f:doc/f:a/@f:x) instance of f:hatSize
Best regards
Michael
"GrasshopperQ" <Grassh...@discussions.microsoft.com> wrote in message
news:AFF87091-3187-4648...@microsoft.com...