Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Siblings #38

Open
dvv opened this issue Jul 7, 2015 · 8 comments
Open

Siblings #38

dvv opened this issue Jul 7, 2015 · 8 comments

Comments

@dvv
Copy link

dvv commented Jul 7, 2015

Hello,
Wonder how do I address a sibling node in predicates, if ever?
TIA,
--Vladimir

@dfilatov
Copy link
Owner

dfilatov commented Jul 7, 2015

There's no "siblings" concept in jspath.
Could you provide a real example where you need to select something depending on siblings? Maybe it can be done via something else.

@dvv
Copy link
Author

dvv commented Jul 7, 2015

Sure.
Say I have an array of records describing a route. Each record contains starting and ending points coordinates. I want to ensure the ending point of record X matches the starting point of record X+1.

@dfilatov
Copy link
Owner

dfilatov commented Jul 8, 2015

Sorry, currently it's impossible to point to the siblings.
Btw, do you want to select such items or just ensure?

@dvv
Copy link
Author

dvv commented Jul 8, 2015

I see.
I do understand this tool is for fetching and I should possibly look at schema validators then. But to ensure the said condition holds means the selection of such siblings contains all siblings, right? So it is possible afaiks to use the tool for both cases.

@dvv
Copy link
Author

dvv commented Jul 8, 2015

Seems, apriori, that if you exposed the index of the current node in array as say $I one could access siblings by subscribing parent node, no?
Smth like foo{x==../foo[$I+1].x}

@dfilatov
Copy link
Owner

dfilatov commented Jul 9, 2015

There's no "parent" selector as well, as json unlike xml has no parents' relations.

@samliddicott
Copy link

I too, coming from xslt proc, need a parent selector and siblings.
I think that json has parents relations in the same way xml does

@dfilatov
Copy link
Owner

dfilatov commented Sep 2, 2016

I think that json has parents relations in the same way xml does

Actually, it doesn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants