following:: axis

Friday, 3 March 2017 · 5 messages
M
meumapple3 Mar 2017 15:50 #
Hi, In a file with a structure like
<l>
<d>
 <f>a</f>
 <f>b</f>
 <f>c</f>
</d>
<d>
 <f>a</f>
 <f>b</f>
 <f>c</f>
</d>
</l>
If I type doc($b)//f[1]/following::f the processor gets out of main memory, even though the file is about 2.2MB and the structure is simply the one showed above (many sibling d elements) Any idea why? Thanks Joseph
CG
Christian Grün3 Mar 2017 15:54 #
Hi Joseph, There are only rare occassions in which the following axis makes sense. Do you know what it does? Which result would you expect for the given document? Christian
Quoted text · meumapple · 23 lines
On Fri, Mar 3, 2017 at 3:50 PM, meumapple <meumapple at gmail.com> wrote: > Hi, > > In a file with a structure like > > <l> > <d> > <f>a</f> > <f>b</f> > <f>c</f> > </d> > <d> > <f>a</f> > <f>b</f> > <f>c</f> > </d> > </l> > > If I type doc($b)//f[1]/following::f the processor gets out of main memory, even though the file is about 2.2MB and the structure is simply the one showed above (many sibling d elements) > > Any idea why? Thanks > > Joseph
M
meumapple3 Mar 2017 16:22 #
Hi Christian, Mine is potentially one of these cases, in that I have to select an f element, which is a word with a reference (@ref='1.2') and then all of the other f elements following that until another f element with another certain value of @ref is reached (irrespectful of the d structures). Consider that there is a mismatch between d elements and f: the elements within a d element could have f elements with different @ref. A solution would be to go from f to parent d, select all of them and then filter out the f elements of the first and last d elements, looking only for those with the right @ref. But I thought that the following:: axis could be a solution. Thanks. Best, Joseph
Quoted text · Christian Grün · 1 line
Il giorno 03 mar 2017, alle ore 15:54, Christian Grün <christian.gruen at gmail.com> ha scritto:
Hi Joseph, There are only rare occassions in which the following axis makes sense. Do you know what it does? Which result would you expect for the given document? Christian
Quoted text · meumapple · 23 lines
> On Fri, Mar 3, 2017 at 3:50 PM, meumapple <meumapple at gmail.com> wrote: > Hi, > > In a file with a structure like > > <l> > <d> > <f>a</f> > <f>b</f> > <f>c</f> > </d> > <d> > <f>a</f> > <f>b</f> > <f>c</f> > </d> > </l> > > If I type doc($b)//f[1]/following::f the processor gets out of main memory, even though the file is about 2.2MB and the structure is simply the one showed above (many sibling d elements) > > Any idea why? Thanks > > Joseph
CG
Christian Grün3 Mar 2017 16:36 #
Quoted text · meumapple · 1 line
> Mine is potentially one of these cases, [...]
A minimized example would be appreciated ;) If you say "all of the other f elements", do you really refer to all elements, or only to the f elements on the current level? In the latter case, following-sibling should do what you need. Using [position() > 1] will be even faster (but it’s probably not applicable to your use case?). This example indicates what the following axis is doing. It returns 4 results (d, e, f, and g):
  <a>
    <b/>
    <d><e/></d>
    <f/>
    <g/>
  </a>//b/following::node()
Quoted text · meumapple · 43 lines
On Fri, Mar 3, 2017 at 4:22 PM, meumapple <meumapple at gmail.com> wrote: > Hi Christian, > > Mine is potentially one of these cases, in that I have to select an f element, which is a word with a reference (@ref='1.2') and then all of the other f elements following that until another f element with another certain value of @ref is reached (irrespectful of the d structures). Consider that there is a mismatch between d elements and f: the elements within a d element could have f elements with different @ref. A solution would be to go from f to parent d, select all of them and then filter out the f elements of the first and last d elements, looking only for those with the right @ref. But I thought that the following:: axis could be a solution. Thanks. > > Best, > Joseph > > Il giorno 03 mar 2017, alle ore 15:54, Christian Grün <christian.gruen at gmail.com> ha scritto: > > Hi Joseph, > > There are only rare occassions in which the following axis makes > sense. Do you know what it does? Which result would you expect for the > given document? > > Christian > > > >> On Fri, Mar 3, 2017 at 3:50 PM, meumapple <meumapple at gmail.com> wrote: >> Hi, >> >> In a file with a structure like >> >> <l> >> <d> >> <f>a</f> >> <f>b</f> >> <f>c</f> >> </d> >> <d> >> <f>a</f> >> <f>b</f> >> <f>c</f> >> </d> >> </l> >> >> If I type doc($b)//f[1]/following::f the processor gets out of main memory, even though the file is about 2.2MB and the structure is simply the one showed above (many sibling d elements) >> >> Any idea why? Thanks >> >> Joseph
M
meumapple3 Mar 2017 16:46 #
Hi Christian, Yes all elements, not only the ones at the same level. The structure is very simple (the one I wrote down, just repeat the d elements). There are only <d> elements and <f> elements inside them.
Quoted text · Christian Grün · 3 lines
> Il giorno 03 mar 2017, alle ore 16:36, Christian Grün <christian.gruen at gmail.com> ha scritto: > > Mine is potentially one of these cases, [...]
A minimized example would be appreciated ;) If you say "all of the other f elements", do you really refer to all elements, or only to the f elements on the current level? In the latter case, following-sibling should do what you need. Using [position() > 1] will be even faster (but it’s probably not applicable to your use case?). This example indicates what the following axis is doing. It returns 4 results (d, e, f, and g):
 <a>
   <b/>
   <d><e/></d>
   <f/>
   <g/>
 </a>//b/following::node()
Quoted text · meumapple · 43 lines
> On Fri, Mar 3, 2017 at 4:22 PM, meumapple <meumapple at gmail.com> wrote: > Hi Christian, > > Mine is potentially one of these cases, in that I have to select an f element, which is a word with a reference (@ref='1.2') and then all of the other f elements following that until another f element with another certain value of @ref is reached (irrespectful of the d structures). Consider that there is a mismatch between d elements and f: the elements within a d element could have f elements with different @ref. A solution would be to go from f to parent d, select all of them and then filter out the f elements of the first and last d elements, looking only for those with the right @ref. But I thought that the following:: axis could be a solution. Thanks. > > Best, > Joseph > > Il giorno 03 mar 2017, alle ore 15:54, Christian Grün <christian.gruen at gmail.com> ha scritto: > > Hi Joseph, > > There are only rare occassions in which the following axis makes > sense. Do you know what it does? Which result would you expect for the > given document? > > Christian > > > >> On Fri, Mar 3, 2017 at 3:50 PM, meumapple <meumapple at gmail.com> wrote: >> Hi, >> >> In a file with a structure like >> >> <l> >> <d> >> <f>a</f> >> <f>b</f> >> <f>c</f> >> </d> >> <d> >> <f>a</f> >> <f>b</f> >> <f>c</f> >> </d> >> </l> >> >> If I type doc($b)//f[1]/following::f the processor gets out of main memory, even though the file is about 2.2MB and the structure is simply the one showed above (many sibling d elements) >> >> Any idea why? Thanks >> >> Joseph

⚡Generated with XQuery