XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] xquery can't find xinclude elements?

On 19/01/2011 08:41, trubliphone wrote:
> Hello.
>
> I am having some trouble with a bit of XQuery - I think that my use of 
> XInclude is the culprit.
>
> I have an XML file stored in eXist which uses XInclude to include 
> other bits of XML:

Your XQuery processor may or may not have an option to expand XInclude 
directives while building the source tree. It's unlikely to happen by 
default. If it doesn't have such an option, you will need to preprocess 
the input with an XInclude processor.

Michael Kay
Saxonica

>
> myFile.xml:
>
> <myFile xmlns:xi="http://www.w3.org/2001/XInclude";>
> <a>
> <xi:include href="myOtherFile.xml" xpointer="xpointer(//d)"/>
> </a>
> <b>
> <foo/>
> </b>
> </myFile>
>
> myOtherFile.xml:
>
> <myOtherFile>
> <c>
> <foo/>
> </c>
> <d>
> <foo/>
> </d>
> </myOtherFile>
>
> I try to access this using some XQuery code:
>
> let $foo := doc('myFile.xml')//foo[parent::b]
>
> But this doesn't return anything.
>
> However, if I write an expression which only accesses the explicit 
> content of myFile.xml and not the included content from myOtherFile.xml:
>
> let $foo := doc('myFile.xml')//foo[parent::a]
>
> This returns <foo/> as expected.
>
> Does anybody know what I'm doing wrong?
>
> Many thanks for your help.
>



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS