beta.xslt.xpath¶
The xpath module provides a Python API for the XPath 3.1 specification.
This Python interface enables the user to compile an xpath expression and to execute it with different input data.
The typical starting point would be the functions beta.xpath.Expression.compile() and beta.xpath.Expression.execute().
There are also utility functions beta.xpath.compile() and beta.xpath.execute() for simplified usage.
>>> seq = execute('fold-left(1 to 7, 2, function($primes, $val){$primes, (2*$val+1)[every $i in $primes satisfies . mod $i]})', session=Session())
>>> TypeConverter().to_python(seq)
(2, 3, 5, 7, 11, 13)
Classes¶
beta.xslt.xpath.ArrayItembeta.xslt.xpath.AtomicItembeta.xslt.xpath.Breakpointbeta.xslt.xpath.BreakpointListbeta.xslt.xpath.CallStackItembeta.xslt.xpath.CancelFlagbeta.xslt.xpath.CompileErrorbeta.xslt.xpath.CompileOptionsbeta.xslt.xpath.Debuggerbeta.xslt.xpath.DecimalFormatbeta.xslt.xpath.DeleteUpdatePrimitivebeta.xslt.xpath.DynamicContextbeta.xslt.xpath.Errorbeta.xslt.xpath.Executablebeta.xslt.xpath.Expressionbeta.xslt.xpath.ExtensionItembeta.xslt.xpath.FunctionItembeta.xslt.xpath.InsertAfterUpdatePrimitivebeta.xslt.xpath.InsertAttributesUpdatePrimitivebeta.xslt.xpath.InsertBeforeUpdatePrimitivebeta.xslt.xpath.InsertIntoAsFirstUpdatePrimitivebeta.xslt.xpath.InsertIntoAsLastUpdatePrimitivebeta.xslt.xpath.InsertIntoUpdatePrimitivebeta.xslt.xpath.InsertUpdatePrimitivebeta.xslt.xpath.Instructionbeta.xslt.xpath.InstructionListbeta.xslt.xpath.Itembeta.xslt.xpath.MapItembeta.xslt.xpath.Modulebeta.xslt.xpath.NodeItembeta.xslt.xpath.PutUpdatePrimitivebeta.xslt.xpath.RenameUpdatePrimitivebeta.xslt.xpath.ReplaceElementContentUpdatePrimitivebeta.xslt.xpath.ReplaceNodeUpdatePrimitivebeta.xslt.xpath.ReplaceValeUpdatePrimitivebeta.xslt.xpath.ReplaceValueUpdatePrimitivebeta.xslt.xpath.Resultbeta.xslt.xpath.ResultListbeta.xslt.xpath.RuntimeErrorbeta.xslt.xpath.RuntimeOptionsbeta.xslt.xpath.Sequencebeta.xslt.xpath.SerializationParamsbeta.xslt.xpath.Sessionbeta.xslt.xpath.TextLocationbeta.xslt.xpath.Tracepointbeta.xslt.xpath.TracepointListbeta.xslt.xpath.TypeConverterbeta.xslt.xpath.UpdatePrimitivebeta.xslt.xpath.Variablebeta.xslt.xpath.WhitespaceHandlerbeta.xslt.xpath.XmlDocumentOptions
Functions¶
-
beta.xslt.xpath.compile(unicode expression_text, *, Session session, **kwargs)¶ Validate the provided expression_text and create a compiled expression from it. Internally uses the xpath.Expression.create_from_options classmethod but has different return values. Returns an
beta.xpath.Expressionobject on success or raises an exception if there are syntax or static errors detected. The keyword arguments corresponding to the properties ofbeta.xpath.CompileOptionsare supported and are used to initialize the internally created options object.
-
beta.xslt.xpath.execute(unicode expression_text, *, Session session, initial_context=None, **kwargs)¶ Compile and execute the xpath expression. Returns an
beta.xpath.Sequence, or raises an exception if an error is encountered. The keyword arguments corresponding to the properties ofbeta.xpath.CompileOptionsandbeta.xpath.RuntimeOptionsare supported and are used in the initialization of the respective objects.>>> res = execute('year-from-date(current-date()) ge 2018') >>> res.to_python() True
Enum Classes¶
-
class
beta.xslt.xpath.BreakPosition¶ An enumeration.
-
class
beta.xslt.xpath.BreakReason¶ An enumeration.
-
class
beta.xslt.xpath.DebugAction¶ An enumeration.
-
class
beta.xslt.xpath.DeliveryFormat¶ The
beta.xpath.DeliveryFormatenumeration controls the delivery of the xslt and xquery final results, including the optional serialization and saving steps.
-
DeliveryFormat.AUTO¶ Will decide between DOCUMENT or RAW based on the build-tree attribute
-
DeliveryFormat.DOCUMENT¶ The returned sequence will contain the xslt result wrapped with an implicitly created document node.
-
DeliveryFormat.RAW¶ The raw result will be delivered in the result sequence.
-
DeliveryFormat.SAVED¶ The result is serialized and written to the output-uri. The result sequence will contain a string, representing the output-uri.
-
DeliveryFormat.SERIALIZED¶ A string, representing the results of serialization (without the final encoding stage), will be returned in the result sequence.
-
class
beta.xslt.xpath.ExecutionMode¶ An enumeration.
-
class
beta.xslt.xpath.ImportStrategy¶ An enumeration.
-
class
beta.xslt.xpath.NormalizationForm¶ The
beta.xpath.NormalizationFormenumeration represents the Unicode Normalization Form used during serialization. The unicode normalization is a process of removing alternative representations of equivalent sequences from textual data.
-
NormalizationForm.FULLY_NORMALIZED¶ Fully normalized, as specified in Character Model for the World Wide Web 1.0: Normalization.
-
NormalizationForm.NFC¶ Normalization Form C.
-
NormalizationForm.NFD¶ Normalization Form D.
-
NormalizationForm.NFKC¶ Normalization Form KC.
-
NormalizationForm.NFKD¶ Normalization Form KD.
-
NormalizationForm.NONE¶ No Unicode Normalization will be applied.
-
class
beta.xslt.xpath.ProcessContents¶ An enumeration.
-
class
beta.xslt.xpath.SchemaLocationStrategy¶ An enumeration.
-
class
beta.xslt.xpath.SerializationMethod¶ The
beta.xpath.SerializationMethodenumeration represents the serialization output methods, as described in XSLT and XQuery Serialization 3.1.
-
SerializationMethod.ADAPTIVE¶
-
SerializationMethod.HTML¶
-
SerializationMethod.JSON¶
-
SerializationMethod.TEXT¶
-
SerializationMethod.XHTML¶
-
SerializationMethod.XML¶
-
class
beta.xslt.xpath.Standalone¶ The
beta.xpath.Standaloneenumeration is used during xml serialization to control the standalone attribute generation in the xml declaration.
-
Standalone.NO¶ The xml declaration will contain standalone=”no”.
-
Standalone.OMIT¶ The xml declaration will contain no standalone attribute.
-
Standalone.YES¶ The xml declaration will contain standalone=”yes”.
-
class
beta.xslt.xpath.Version¶ An enumeration.
-
class
beta.xslt.xpath.XsdVersion¶ An enumeration.