[xquery-talk] xpath default namespace

Leo Studer leo.studer at varioweb.ch
Wed Jun 1 02:38:52 PDT 2016


Hi Ghislain

thank you for your input, which solves my problem.

However, if I have the same element name in two different namespaces, then the use of a wildcard namespace makes problems ;-).

Always
Leo

> On 01 Jun 2016, at 11:06, Ghislain Fourny <g at 28.io> wrote:
> 
> Hi Leo,
> 
> If the input has no namespace, then I think you can declare the default namespace according to your output (if it is important to you that your output uses it as a default namespace).
> 
> Then there is a workaround to navigate the input with /*:foo/*:bar expressions, where the joker prefix should catch the absence of namespace.
> 
> I hope it helps?
> 
> Kind regards,
> Ghislain
>  
> 
> On Wed, Jun 1, 2016 at 10:20 AM, Leo Studer <leo.studer at varioweb.ch <mailto:leo.studer at varioweb.ch>> wrote:
> Hi Michael
> 
> >
> >
> > The main difference from the XSLT xpath-default-namespace is that this default applies both to names in path expressions and to names in element constructors, which is inconvenient when the input and output documents are in different namespaces.
> >
> > Michael Kay
> > Saxonica
> 
> this is exactly my problem. The XML file has no namespace and the output has a namespace.
> 
> Fist I tried
> 
>         declare namespace null=“”;
> 
> and in the query I wrote something like
> 
>         null:elementName
> 
> Then I get the error that namespace null is not declared….
> 
> The only solution I found is to put a namespace in the XML file (which is not really what I want).
> 
> Is there another way?
> 
> Cheers
> Leo
> _______________________________________________
> talk at x-query.com <mailto:talk at x-query.com>
> http://x-query.com/mailman/listinfo/talk <http://x-query.com/mailman/listinfo/talk>
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://x-query.com/pipermail/talk/attachments/20160601/8e0d2228/attachment.html>


More information about the talk mailing list