Questions tagged [xpath-3.0]

Use this tag for questions specific to XML Path Language (XPath) version 3.0

W3C Recommendations:

Resources:


Online Training

A"The Evolution of XPath: What’s New in XPath 3.0" -- A Pluralsight video-course (4.5h), by Dimitre Novatchev


47 questions
1
vote
1 answer

Split elements into sections

I'd like to split a text into sections: The source XML:

hello

nice

BREAK

world

My half successful attempt:
topskip
  • 16,207
  • 15
  • 67
  • 99
1
vote
1 answer

Sorting the elements returned with simple mapping operator in Xquery

I'm trying to use the simple mapping operator (!) as below (1,7,2,4,5)!(.) The above would return 1,7,2,4,5 as a sequence.But I need the values to be sorted in ascending order. Is it possible to use order by with this mapping operator?If so,please…
Antony
  • 183
  • 8
1
vote
1 answer

Divide a set of items XPath

I am new to XPath so do not know much. I have been googling for a bit and cannot find anything, maybe I am just searching the wrong thing but I thought I would ask on here. I am currently trying to divide a set of numbers, (100, 200, 300), all by…
MaxCulley
  • 23
  • 5
1
vote
2 answers

XPath recursive "parent"-selection in a flat structure

The following XML is given: 1 2 1 3 2 4
moritz.vieli
  • 1,747
  • 1
  • 14
  • 17
1
vote
2 answers

Round time in Xpath

What is the simplest and correct way to round the time and dateTime in XPath? For example, how to define a function local:round-time-to-minutes in such way that the following test-case: let $t1 := xs:time( "12:58:37" ) let $t2 :=…
ruvim
  • 7,151
  • 2
  • 27
  • 36
1
vote
1 answer

XPath 3.0 XML parsing functions in XSLT

I have a sequence of strings that I need to parse as XML using XSLT. For example: <span>Foo</span> & <span>bar</span> have been tagged. When I try to parse this using fn:parse-xml-fragment (using Saxon-PE 9.6.0.5), two…
tat
  • 321
  • 1
  • 19
1
vote
1 answer

XPath 3.0 compare dates diffrence with duration literal

Given XML:
lospejos
  • 1,976
  • 3
  • 19
  • 35
1
vote
1 answer

Xpath3 - Get name from SOAP message

This is my SOAP message and I want to get the name of the child element of soap:Body:
gtx911
  • 1,189
  • 4
  • 25
  • 46
1
vote
1 answer

XPath 3.1 in XSL-T 3.0 How to parse free format String to DateTime as in java.text.SimpleDateFormat?

I would like to parse almost free format String to DateTime in XSL-T 3.0 as one can do it in Java using java.text.SimpleDateFormat. Is it possible? I am using the latest Saxon HE 9.7.0.1 for Java and consulting it with the W3C CR 3.1 "XPath and…
Stepan RYBAR
  • 67
  • 1
  • 5
1
vote
1 answer

error in declaring higher-order functions in XPath 3.0: must declare return type?

Following @DimitreNovatchev's article Programming in XPath 3.0, and using BaseX GUI as the test environment, I tried some of the examples that define functions that accept functions as parameters. E.g. with let $compose := function($f as…
LarsH
  • 27,481
  • 8
  • 94
  • 152
1
vote
2 answers

How to find all numbers in a string

Ich versuche mit einer Funktion sämtliche Zahlen aus einem Element oder String zu ermitteln. Dabei soll die Anzahl der Zahlen und ihre Stelligkeit egal sein. Folgende Funktion habe ich bislang geschrieben:
1
vote
1 answer

xquery- how to obtain min/max value from a set of values that are obtained by subtracting consecutive members from a list

In an xquery expression, I have obtained a set of values within a for-expression, and one value is in a separate variable. Now, I want to subtract the single value from first value of the list, and then subtract consecutive members of the list from…
Arvind
  • 6,404
  • 20
  • 94
  • 143
1
vote
2 answers

xquery- how to get difference between successive values in a list of numeric values

I have extracted successfully one value in one variable, and a list of values in another variable (as part of my XQuery expression). Now, suppose the single-value variable is x=1 and the list variable is named y with values 2,4,7,11,16 I want…
Arvind
  • 6,404
  • 20
  • 94
  • 143
0
votes
1 answer

Xpath - multiple "or conditions" with if else

Using the below XML example, what's the best way to write the Xpath3 expression If fruit is apple and quantity is less than 12 or if fruit is watermelon and quantity is less than 2) then return "in-store shopping" otherwise "online"` …
senywork7
  • 3
  • 1
0
votes
1 answer

How do I use XPath 3.0 to find the latest date of each non-unique ID?

First time I'm posting here myself instead of searching for existing answers. Wanted to try it out in case my demand for more specific questions increases. So I want to write an XPath 3.0 query to extract all the names from each , but if there…
gpkba
  • 3
  • 2