Skip to content

Commit

Permalink
Merge pull request #89 from ballsteve/dev
Browse files Browse the repository at this point in the history
Version 1.0 Release
  • Loading branch information
ballsteve authored Jul 24, 2024
2 parents d7c2f79 + 2093983 commit 313aafd
Show file tree
Hide file tree
Showing 1,124 changed files with 44,226 additions and 8,887 deletions.
641 changes: 333 additions & 308 deletions Cargo.lock

Large diffs are not rendered by default.

30 changes: 17 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "xrust"
version = "0.9.0"
version = "1.0.0"
keywords = ["xml", "json", "xpath", "xslt", "tree"]
categories = ["parser-implementations"]
description = "Support for XPath, and XSLT"
description = "Support for XPath and XSLT"
authors = ["Steve Ball <Steve.Ball@explain.com.au>", "Daniel Murphy <daniel@devasta.ie>"]
license = "Apache-2.0"
repository = "https://github.com/ballsteve/xrust"
Expand All @@ -17,27 +17,31 @@ default = ["xslt"]
xslt = []

[[bench]]
name = "bench_intmuttree"
name = "bench_smite"
harness = false

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rust_decimal = "1.32"
rust_decimal_macros = "1.32"
rust_decimal = "1.35.0"
rust_decimal_macros = "1.35.0"
lexers = "0.1.4"
unicode-segmentation = "1.10.1"
chrono = "0.4.31"
url = "2.4.1"
unicode-segmentation = "1.11.0"
chrono = "0.4.38"
url = "2.5.2"
pkg-version = "1.0.0"
# This is for the forest tree implementation
#generational-arena = "0.2"
regex = "1.10.2"
regex = "1.10.5"
# For formatting numbers
formato = "0.2.0"
# For formatting integers
english-numbers = "0.3.3"
italian_numbers = "0.1.0"

[dev-dependencies]
criterion = "0.5.1"
encoding_rs = "0.8.33"
encoding_rs = "0.8.34"
encoding_rs_io = "0.1.7"
#ixml = { package = "earleybird", version = "0.0.1" }
#earleybird = {path = "../earleybird"}
earleybird = {git = "https://github.com/mdubinko/earleybird.git"}
indextree = "4.6.0"
indextree = "4.6.1"
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ XPath, XQuery, and XSLT for Rust

Pronounced "crust".

The goal of this project is to implement [XPath 3.1](https://www.w3.org/TR/xpath-31/), [XQuery 3.1](https://www.w3.org/TR/xquery-31/) and [XSLT 3.0](http://www.w3.org/TR/xslt-30/) in Rust. Also included is an XML parser, using a parser combinator inspired by Nom.
The goal of this project is to implement [XPath 3.1](https://www.w3.org/TR/xpath-31/), [XQuery 3.1](https://www.w3.org/TR/xquery-31/) and [XSLT 3.0](http://www.w3.org/TR/xslt-30/) in Rust.
Also included is an XML parser, using a parser combinator inspired by Nom.

Currently the project is a proof-of-concept. There is a rudimentary implementation of the [XQuery and XPath Data Model 3.1](https://www.w3.org/TR/xpath-datamodel-31/), along with an implementation of XPath which, roughly speaking, conforms to version 1.0 (with a few other features, such as FLWR expressions). The XSLT implementation can evaluate basic XSL stylesheets, but is still incomplete wrt the XSLT v1.0 specification.
Currently, the project has achieved the functional equivalent of XPath v1.0 and XSLT 1.0. That is, all of the elements and functions in v1.0 XPath and XSLT have been implemented.
However, it is not *compliant* with v1.0. This is because it implements the v3.0 data model.

In addition to the (rudimentary) implementation of the [XQuery and XPath Data Model 3.1](https://www.w3.org/TR/xpath-datamodel-31/) data model, a few other features of XPath and XSLT v2.0/v3.0 have been implemented, such as FLWR expressions, grouping (i.e. xsl:for-each-group), and user-defined functions.

## Design

Expand All @@ -30,16 +34,19 @@ This approach means that the XPath and XSLT modules are simply mappings from the

## The Plan

1. Complete the XPath 1.0 implementation.
2. Implement all XSLT v1.0 functionality.
3. Improve XDM, XPath; achieve v2.0-v3.1 compliance.
4. Introduce all v3.0 features to the XSLT engine.
1. Complete the XPath 1.0 implementation. (Done!)
2. Implement all XSLT v1.0 functionality. (Done!)
3. Improve XDM, XPath; achieve v2.0 compliance.
4. Add v2.0 features to the XSLT engine.
4. Further improve XDM, XPath; achieve v3.1 compliance.
5. Add remaining v3.0 features to the XSLT engine.

NB. We're picking the low-hanging fruit first. So major, fundamental features of the languages are being implemented to begin with. The fine detail will be added later. So although we're aiming for v1.0 functionality as a baseline, the eventual desire to implement all of v3.0 dictates that some more advanced features will be implemented sooner rather than later.
NB. We're picking the low-hanging fruit first. So major, fundamental features of the languages are being implemented to begin with. The fine detail will be added later.
Although the eventual desire is to implement all of XSLT v3.0 functionality, some more advanced features will be implemented sooner rather than later.

## Documentation

See the [XSLT module](xrust/xslt/index.html) for an example of how to evaluate an XSL stylesheet.
See the [XSLT module](https://docs.rs/xrust/0.10.0/xrust/xslt/index.html) for an example of how to evaluate an XSL stylesheet.

## Examples

Expand All @@ -48,6 +55,6 @@ See the [XSLT module](xrust/xslt/index.html) for an example of how to evaluate a

## Compliance

Status of [docs/compliance.md](https://github.com/ballsteve/xrust/blob/main/docs/compliance.md) with XDM, XPath, XQuery, and XSLT.
Status of [standards implementation](https://github.com/ballsteve/xrust/blob/main/docs/compliance.md) for XDM, XPath, XQuery, and XSLT.


49 changes: 0 additions & 49 deletions benches/bench_anode.rs

This file was deleted.

50 changes: 0 additions & 50 deletions benches/bench_forest.rs

This file was deleted.

42 changes: 0 additions & 42 deletions benches/bench_intmuttree.rs

This file was deleted.

41 changes: 41 additions & 0 deletions benches/bench_smite.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
use std::rc::Rc;

use criterion::{black_box, criterion_group, criterion_main, Criterion};

use xrust::item::Node;
use xrust::qname::QualifiedName;
use xrust::trees::smite::{Node as SmiteNode, RNode};
use xrust::value::Value;

fn make_rnode(n: u64) -> RNode {
let mut a = Rc::new(SmiteNode::new());
let mut b = a
.new_element(QualifiedName::new(None, None, String::from("Test")))
.expect("unable to create element");
a.push(b.clone()).expect("unable to add node");
(1..n).for_each(|i| {
let mut l1 = a
.new_element(QualifiedName::new(None, None, String::from("Level-1")))
.expect("unable to create element");
b.push(l1.clone()).expect("unable to add node");
(1..n).for_each(|k| {
let mut l2 = a
.new_element(QualifiedName::new(None, None, String::from("Level-2")))
.expect("unable to create element");
l1.push(l2.clone()).expect("unable to add node");
l2.push(
a.new_text(Rc::new(Value::from(format!("node {}-{}", i, k))))
.expect("unable to create text node"),
)
.expect("unable to add node");
});
});
a
}

fn rnode(c: &mut Criterion) {
c.bench_function("rnode 100", |b| b.iter(|| make_rnode(black_box(1000))));
}

criterion_group!(benches, rnode);
criterion_main!(benches);
Loading

0 comments on commit 313aafd

Please sign in to comment.