I am using XSLT. I know the Inline Function Expressions, Is there some way to declare a named function in xpath expression? because I need the function name to implement a recursive call.
How can I implement a user-defined function with a name in the xpath expression?
446 views Asked by cmf41013 At
2
There are 2 answers
2
Michael Kay
On
There is no way to declare a named function in XPath; XPath 3.1 only allows anonymous inline functions, and these cannot be recursive. I'm told that there's a way to achieve recursion in anonymous functions using a technique called Y-combinators, but it's fairly mind-boggling and I've never got my head around it. Your best approach, as Martin suggests, is to put this part of the logic at the XSLT level.
Related Questions in XSLT
- Sorting items after building an XML feed?
- link href to website css does not work since upgrading to Windows Server 2019
- Chaining templates in XSLT 2.0
- XPath - how to exclude text from child node
- Reuse XSLT for different XML inputs using parameters in nodeJS with saxon-js
- How to iterate XSL and get nodes
- XSLT to tun flat xml structure into hierarchical
- transform '?oxy_comments' into xml tag
- xslt transform hierarchy into new hierarchy
- Convert element tags to key value pair in OIC map
- Converting characters in XML text node to subscript or superscript with XSLT
- Saxon HE 12.4 Fails to provide the error location in ErrorReporter
- how can I use net.sf.saxon.s9api.XsltTransformer in multiple threads to avoid impacting perfromance and throughput?
- Issue with XSL Display since Chrome 123 Update
- 'XML External Entity Injection' issue isn't resolving even after fortify recommended suggestion
Related Questions in XPATH
- How can I load all the elements of a webpage with Selenium?
- Why is the copied XPATH not working for selenium?
- When I'm typing an Xpath or CSS selector in the console why won't matching results appear while typing? Results only appear after pressing Enter
- Nokogiri only returning 5 results
- XPath - how to exclude text from child node
- xpath issue in nested div
- Question using XPath to look for a sibling of a td with a certain name
- How to separate XML tags in freemarker in body function
- Wait using Path (Puppeteer)
- why can't I retrieve the track of my Spotify playlist even i have given correct full xpath
- How do I click the correct link based on text contained in another element using Selenium + Python?
- PHP DOMDocument ignores first table's closing tag
- String tokenise an xpath expression
- Problem to get into the next page, Selenium
- Scrapy / extracting data across multiple HTML tags
Related Questions in XSLT-3.0
- XSLT 3.0 Transformation
- problem specifying CDATA element in xsl:output instruction
- How to unwrap and enclose elements between two other elements
- Logic of except in XSLT
- XSLT embed json in a HTML
- xslt code to generate an element in the target even it is coming multiple times from source under for loop?
- selecting preceding cousins (including siblings)
- get year, week number, week day number from format-date, BUT my weeks start on Saturday
- can I put a map inside an element? - Cannot add a map as a child of a constructed element
- XSLT 2 or 3 - Add structure to a flat XML file using for-each-group : group-starting-with
- SAXON XSLT 3.0 unable to generate an xml:base attribute within generated <rdf:RDF /> output
- Copy !DOCTYPE using xslt
- Update a specific position in a string XSLT
- XSLT for-each-group group-starting-with tail(current-group())
- XSLT preceding-sibling how-to get previous non-blank value
Related Questions in XPATH-3.1
- selecting preceding cousins (including siblings)
- Dynamic XQuery using saxon:evaluate not working in Oxygen with an XPath 3.1 type expression?
- XSL output array of string as text
- How to iterate a json array in xslt
- How to iterate Json Array in Xslt 4.0
- How to extract value from json object in xslt mapping
- How to write the Xpath for the json field having white space?
- Xpath - multiple "or conditions" with if else
- Execute XPath 3.1 on Java map
- XPath: How to sort a map?
- Multiple string replacements
- XPath to retrive XML tag value without Namespace and prefix
- Parsing a URL query string into a map of parameters with XPath
- Creating xsl:result-document with xpath 3.1 fn:transform using saxon 9.9 EE
- XPath sorting not persistent?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
In XSLT I would simply suggest to use
xsl:functionas that way your function has a name and you can call it recursively inside of the function body.As for pure XPath 3, Dimitre explored that path some years ago in https://dnovatchev.wordpress.com/2012/10/15/recursion-with-anonymous-inline-functions-in-xpath-3-0-2/ using
letand higher-order functions (a feature not supported unfortunately in Saxon 9 HE), I think his code there uses a function type syntax not quite aligned with the final spec so his example would need to bewhich could be shortened to
I think given the latest allowed syntax.