Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Xml.​Xsl.​XsltContext
Assembly: System.Xml.ReaderWriter
Inheritance: object → XmlNamespaceManager → XsltContext
Implemented Interfaces
- Collections.​IEnumerable Implemented by: XmlNamespaceManager
- IXmlNamespaceResolver Implemented by: XmlNamespaceManager
Encapsulates the current execution context of the Extensible Stylesheet Language for Transformations (XSLT) processor allowing XML Path Language (XPath) to resolve functions, parameters, and namespaces within XPath expressions.
Properties
public
bool
Whitespace
When overridden in a derived class, gets a value indicating whether to include white space nodes in the output.
public
string
DefaultNamespace
Gets the namespace URI for the default namespace.
public
XmlNameTable
NameTable
Gets the <see cref="T:System.Xml.XmlNameTable" /> associated with this object.
Methods
public
int
CompareDocument​(string baseUri,
string nextbaseUri)
When overridden in a derived class, compares the base Uniform Resource Identifiers (URIs) of two documents based upon the order the documents were loaded by the XSLT processor (that is, the <see cref="T:System.Xml.Xsl.XslTransform" /> class).
Returns An integer value describing the relative order of the two base URIs: -1 if <paramref name="baseUri" /> occurs before <paramref name="nextbaseUri" /> ; 0 if the two base URIs are identical; and 1 if <paramref name="baseUri" /> occurs after <paramref name="nextbaseUri" /> .
baseUri
The base URI of the first document to compare.
nextbaseUri
The base URI of the second document to compare.
public
bool
PreserveWhitespace​(XPath.​XPathNavigator node)
When overridden in a derived class, evaluates whether to preserve white space nodes or strip them for the given context.
Returns <see langword="true" /> if the white space is to be preserved; <see langword="false" /> if the white space is to be stripped.
node
The white space node that is to be preserved or stripped in the current context.
public
IXsltContextFunction
ResolveFunction​(string prefix,
string name,
XPath.​XPathResultType[] ArgTypes)
When overridden in a derived class, resolves a function reference and returns an <see cref="T:System.Xml.Xsl.IXsltContextFunction" /> representing the function. The <see cref="T:System.Xml.Xsl.IXsltContextFunction" /> is used at execution time to get the return value of the function.
Returns An <see cref="T:System.Xml.Xsl.IXsltContextFunction" /> representing the function.
prefix
The prefix of the function as it appears in the XPath expression.
name
The name of the function.
ArgTypes
An array of argument types for the function being resolved. This allows you to select between methods with the same name (for example, overloaded methods).
public
IXsltContextVariable
ResolveVariable​(string prefix,
string name)
When overridden in a derived class, resolves a variable reference and returns an <see cref="T:System.Xml.Xsl.IXsltContextVariable" /> representing the variable.
Returns An <see cref="T:System.Xml.Xsl.IXsltContextVariable" /> representing the variable at runtime.
prefix
The prefix of the variable as it appears in the XPath expression.
name
The name of the variable.
public
void
AddNamespace​(string prefix,
string uri)
Inherited from XmlNamespaceManager
Adds the given namespace to the collection.
prefix
The prefix to associate with the namespace being added. Use String.Empty to add a default namespace.
Note If the <see cref="T:System.Xml.XmlNamespaceManager" /> will be used for resolving namespaces in an XML Path Language (XPath) expression, a prefix must be specified. If an XPath expression does not include a prefix, it is assumed that the namespace Uniform Resource Identifier (URI) is the empty namespace. For more information about XPath expressions and the <see cref="T:System.Xml.XmlNamespaceManager" /> , refer to the <see cref="M:System.Xml.XmlNode.SelectNodes(System.String)" /> and <see cref="M:System.Xml.XPath.XPathExpression.SetContext(System.Xml.XmlNamespaceManager)" /> methods.
uri
The namespace to add.
GetEnumerator​()
Inherited from XmlNamespaceManager
Returns an enumerator to use to iterate through the namespaces in the <see cref="T:System.Xml.XmlNamespaceManager" /> .
Returns An <see cref="T:System.Collections.IEnumerator" /> containing the prefixes stored by the <see cref="T:System.Xml.XmlNamespaceManager" /> .
public
Collections.​Generic.​IDictionary<​string, string>
GetNamespacesInScope​(XmlNamespaceScope scope)
Inherited from XmlNamespaceManager
Gets a collection of namespace names keyed by prefix, which can be used to enumerate the namespaces currently in scope.
Returns A collection of namespace and prefix pairs currently in scope.
scope
An enumeration value that specifies the type of namespace nodes to return.
public
bool
HasNamespace​(string prefix)
Inherited from XmlNamespaceManager
Gets a value indicating whether the supplied prefix has a namespace defined for the current pushed scope.
Returns <see langword="true" /> if there is a namespace defined; otherwise, <see langword="false" /> .
prefix
The prefix of the namespace you want to find.
public
string
LookupNamespace​(string prefix)
Inherited from XmlNamespaceManager
Gets the namespace URI for the specified prefix.
Returns The namespace URI for <paramref name="prefix" /> or <see langword="null" /> if there is no mapped namespace. The returned string is atomized.
For more information on atomized strings, see the <see cref="T:System.Xml.XmlNameTable" /> class.
prefix
The prefix whose namespace URI you want to resolve. To match the default namespace, pass String.Empty.
public
string
LookupPrefix​(string uri)
Inherited from XmlNamespaceManager
Finds the prefix declared for the given namespace URI.
Returns The matching prefix. If there is no mapped prefix, the method returns String.Empty. If a null value is supplied, then <see langword="null" /> is returned.
uri
The namespace to resolve for the prefix.
public
bool
PopScope​()
Inherited from XmlNamespaceManager
Pops a namespace scope off the stack.
Returns <see langword="true" /> if there are namespace scopes left on the stack; <see langword="false" /> if there are no more namespaces to pop.
public
void
PushScope​()
Inherited from XmlNamespaceManager
Pushes a namespace scope onto the stack.
public
void
RemoveNamespace​(string prefix,
string uri)
Inherited from XmlNamespaceManager
Removes the given namespace for the given prefix.
prefix
The prefix for the namespace.
uri
The namespace to remove for the given prefix. The namespace removed is from the current namespace scope. Namespaces outside the current scope are ignored.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object