Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

XQuery/Using the Math Module

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Motivation You want to use basic math functions directly within your XQuery program. Method We will use the XQuery module function that is available for eXist. Configuring eXist You must first make sure that the math module is enabled in your version of eXist. To do this make sure the following lines are uncommented in your $EXIST_HOME/conf.xml file: <module class="org.exist.xquery.modules.math.MathModule" uri="http://exist-db.org/xquery/math" /> If you make a change to the file you will need to restart eXist. Listing of Math functions You can now just reference any of the math functions in the math module. Here is a list of all the functions: http://demo.exist-db.org/exist/functions/math Sample Program Here is a sample XQuery program: xquery version "1.0"; <results> <abs>{math:abs(-3.1)}</abs> </results> Results <results> <abs>3.1</abs> </results>