Saxon API for .NET |

# XPathCompiler.Compile Method

Compile an expression supplied as a String.

public XPathExecutable Compile(
string source
);

#### Parameters

source
  A string containing the source text of the XPath expression

#### Return Value

An `XPathExecutable` which represents the compiled xpath expression object. The XPathExecutable may be run as many times as required, in the same or a different thread. The `XPathExecutable` is not affected by any changes made to the `XPathCompiler` once it has been compiled.

#### Example

                XPathExecutable q = compiler.Compile("distinct-values(//*/node-name()");

#### See Also

XPathCompiler Class | Saxon.Api Namespace