Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XSLT getting last element

Tags:

xslt

xpath

menu

People also ask

How do I select the last element in XPath?

"last() method" selects the last element (of mentioned type) out of all input element present. Let us consider an example in which we will try to locate the last text field on the Google sign-up page i.e. "Confirm Password" field.

What is an XPath query?

XPath (XML Path Language) is a query language that can be used to query data from XML documents. In RUEI, XPath queries can be used for content scanning of XML documents. A complete specification of XPath is available at http://www.w3.org/TR/xpath .

What is XPath expression in xml?

XPath uses path expressions to select nodes or node-sets in an XML document. These path expressions look very much like the expressions you see when you work with a traditional computer file system. XPath expressions can be used in JavaScript, Java, XML Schema, PHP, Python, C and C++, and lots of other languages.


You need to put the last() indexing on the nodelist result, rather than as part of the selection criteria. Try:

(//element[@name='D'])[last()]