Skip to content

Releases

LandrixXml 0.5.0

Choose a tag to compare

@landrix landrix released this 17 Nov 12:54

An XSLT 2.0 processor (LandrixXmlXslt, optional) that runs the KoSIT
report stylesheets and the XRechnung visualization with the output
Saxon HE writes, byte for byte; XPath 1.0 compatibility mode, SVRL into
an open writer with the message text as the rule file has it, and a
stack budget for deep recursion. The documented API only gains
additions.

Added

  • XSLT (LandrixXmlXslt, optional): a subset of XSLT 2.0 run as Saxon
    HE runs it, with TLandrixXmlXsltStylesheet (compiled once,
    immutable), TLandrixXmlXsltTransformer (parameters as strings, trees
    or XPath values, initial mode and template, output properties,
    messages), TLandrixXmlXsltResolver (imports and documents from files
    or a catalog, no network) and ELandrixXmlXsltError (an
    ELandrixXmlXPathError with the W3C code, the module and the line).
    See the README for the supported instructions; the KoSIT report
    stylesheet and the XRechnung visualization (XR XML and HTML) give the
    output Saxon gives, byte for byte.
    TLandrixXmlErrorCode gains xecXslt.
  • XSLT: system-property(), function-available() and
    element-available(); a name given with a prefix is resolved with the
    namespaces of the calling expression.
  • XSLT: output in US-ASCII and ISO-8859-1. A character the encoding does
    not have is a hexadecimal character reference in text and attribute
    values and SERE0008 elsewhere (comments, names, method text), as in
    Saxon.
  • XSLT: xsl:strip-space and xsl:preserve-space.
  • XSLT: use-when and xsl:use-when (conditional inclusion).
  • XSLT: xsl:sort (in xsl:for-each, xsl:apply-templates and
    xsl:for-each-group), xsl:perform-sort, xsl:analyze-string and
    regex-group().
  • XSLT: xsl:next-match and xsl:apply-imports (with xsl:with-param).
  • XSLT: xsl:attribute-set and use-attribute-sets (on literal result
    elements, xsl:element and xsl:copy).
  • XSLT: xsl:character-map and use-character-maps (on xsl:output
    and xsl:result-document), applied by the xml, html, xhtml and text
    output methods as in Saxon.
  • XSLT: xsl:namespace. An excluded namespace that a literal result
    element or its attribute uses is no longer a namespace node of its own:
    the namespace fixup declares it, as in Saxon. The fixup keeps an
    attribute's own prefix where nothing on the element binds it otherwise
    and names new prefixes as Saxon does. exclude-result-prefixes now
    excludes the namespace URIs bound where it is, not every later binding
    of the same prefix.
  • XSLT: xsl:namespace-alias (literal result elements, their attributes
    and namespace nodes; an aliased or alias result namespace is copied
    even when excluded).
  • XSLT: simplified stylesheets (a literal result element with
    xsl:version as a stylesheet module).
  • XSLT: xpath-default-namespace and xsl:xpath-default-namespace.
  • XSLT: xml:base in a stylesheet: the static base URI of the
    instructions below it (static-base-uri(), resolve-uri(), doc(),
    document(), unparsed-text()), the href of xsl:include and
    xsl:import, and the base URI of the temporary trees an instruction
    makes and of nodes made or copied at the top of a sequence, as Saxon
    gives them.
  • XSLT: xsl:key with a sequence constructor instead of use, and key
    names with a prefix (key() resolves it with the namespaces of the
    calling expression).
  • XSLT: English words and ordinals as Saxon HE writes them, in
    xsl:number (format="w", "W", "Ww", ordinal) and in the
    pictures of format-date() and its relatives ([Dwo], [D1o], also
    letters [Da]). xsl:number accepts lang (an invalid language code
    is XTDE0030; the numbers stay English, as in Saxon HE) and
    letter-value. A year cut to a maximum width is its last digits as a
    number, as in Saxon ([Y1,*-3] of 2013 is 13, no longer 013).
  • XSLT: [xsl:]expand-text (XSLT 3.0 text value templates, as Saxon
    also runs them in a stylesheet with version="2.0"): text in a sequence
    constructor and in xsl:text with expressions in braces ({{ and }}
    for braces, empty braces for the empty sequence); XTSE0350,
    XTSE0370 and XTSE0020 as for attribute value templates.
  • XSLT: copy-namespaces="no" on xsl:copy and xsl:copy-of: a copy
    has the namespaces its names need; below the top of a deep copy an
    element has those and the ones of the place the copy goes to, as
    Saxon writes them (also xmlns="" or a declaration repeated).
    true/1/false/0 are accepted as in Saxon; another value is
    XTSE0020.
  • XSLT: the output property byte-order-mark for every output method:
    as in Saxon the byte order mark is written for UTF-8 only (none for
    US-ASCII or ISO-8859-1); TransformToUtf8 and SerializeToUtf8 begin
    with it when the encoding asked for is UTF-8.
  • XSLT: disable-output-escaping on xsl:text and xsl:value-of, as
    in Saxon: text written to the final result tree (also by
    xsl:result-document) is serialized without escaping; the character
    map, normalization and character references for characters the
    encoding lacks still apply, and a CDATA section ends before it. A text
    node a function or a template with as returns stays raw when it is
    added to the result (not when it is copied with xsl:copy-of). It is
    ignored in temporary trees, attributes and comments, and when the
    result is returned as a tree; where Saxon keeps it in a node built in
    a sequence or in a temporary tree it is xecUnsupported at run time.
    Besides yes and no, true, 1, false and 0 are accepted as in
    Saxon; another value is XTSE0020.
  • XSLT: a collation URI that is not known as a collation is the error
    of the specification: XTDE1035 (xsl:sort), XTDE1110
    (xsl:for-each-group; FOCH0002 for a computed one, as in Saxon),
    XTSE1210 (xsl:key), XTSE0125 (default-collation without a known
    collation). default-collation takes the first known collation of its
    list, and the collation of xsl:for-each-group may be an attribute
    value template. UCA, Saxon and html-ascii-case-insensitive
    collations remain unsupported.
  • XSLT: the output property normalization-form (NFC, NFD, NFKC, NFKD,
    none) for every output method: text, attribute values and CDATA
    sections are normalized, names and comments are not; as in Saxon the
    character map comes first and its strings are not normalized. Another
    value (also fully-normalized) is SESU0011 when the result is
    serialized.
  • XSLT: forwards compatible processing for a version above 3.0, as in
    Saxon: unknown declarations are ignored with their content, an unknown
    instruction runs its xsl:fallback (XTSE0010 without one), unknown
    attributes of XSLT elements are ignored. A version that is no decimal
    is XTSE0110 (one below 2.0: backwards compatible processing, below).
  • XSLT: extension-element-prefixes (also on xsl:template and other
    XSLT elements, and as xsl:extension-element-prefixes on literal
    result elements). No extension instruction is known: an element in an
    extension namespace runs its xsl:fallback children, or raises
    XTDE1450 when it is evaluated without one; the extension namespaces
    are not copied to literal result elements. As in Saxon, #default
    means no namespace.
  • XSLT: doctype-system and doctype-public (xml and xhtml: with a
    system identifier; html: either, the name html), written as Saxon
    writes them before the first element; with doctype-system or
    standalone a second element or text at the top is SEPM0004; a
    public identifier with a character other than the XML PubidChar (or a
    tab), or a system identifier with both quote characters, is
    XTSE0020.
  • XSLT: cdata-section-elements on xsl:output (the union of every
    definition) and xsl:result-document (added to the format's), for the
    xml and xhtml methods. The text of those elements is written in CDATA
    sections as Saxon writes them: ]]> split, a character the encoding
    does not have as a character reference between sections, no character
    map. The output property holds the Clark names.
  • XSLT: document() with a second argument (the base URI of that node for
    every relative URI; XPTY0004 for no single node, XTDE1162 without a
    base URI).
  • XPath: TLandrixXmlXPathStaticContext.DefaultElementNamespace (the
    default element/type namespace, '' unless set), also readable on the
    compiled expression.
  • XSLT: the output method xhtml, as Saxon writes it (also the default
    method for an html root element in the XHTML namespace).
  • XSLT: tunnel parameters (tunnel="yes" on xsl:with-param and
    template parameters). An initial template with a required parameter is
    XTDE0060, as in XSLT 2.0.
  • XSLT: xsl:result-document and named xsl:output definitions.
    Secondary results are collected by the transformer
    (ResultDocumentCount, ResultDocuments, FindResultDocument,
    TLandrixXmlXsltResultDocument), href resolves against the new
    BaseOutputUri; nothing is written to disk.
  • tools/run-xslt-tests.py runs the XSLT 1.0 and 2.0 cases of the W3C
    XSLT test suite against a baseline (tests/data/xslt-baseline.txt).
  • XPath: the string concatenation operator || (XPath 3.0) in the
    xppSaxon profile, as Saxon accepts it in stylesheets that declare
    XSLT 2.0; a || b || c is concat(a, b, c). The xppXPath20 profile
    rejects it with XPST0003.
  • XPath: XPath 1.0 compatibility mode
    (TLandrixXmlXPathStaticContext.XPath10Compatible, default False,
    kept by each expression): function arguments take the first item and
    are converted with fn:string or fn:number, arithmetic works on the
    first items as xs:double (NaN for an empty operand), and general
    comparisons follow XPath 1.0, all as in Saxon. Arguments of user
    functio...
Read more

LandrixXml 0.4.0

Choose a tag to compare

@landrix landrix released this 12 Nov 17:59

Exact normalization check, faster XPath and XML Schema validation, a fix
for nested repetitions in content models and two portability fixes. The
documented API only gains additions.

Added

  • LandrixXmlNormalize: LandrixXmlIsNormalizedUtf8 and
    LandrixXmlIsNormalizedCodePoints tell exactly whether a text is in a
    normalization form (the Unicode quick check, and a normalization only
    when it answers "maybe"). The code point variant rejects values that
    are not Unicode scalar values with xecInvalidUnicode. The constant
    LandrixXmlNormalizeUnicodeVersion names the Unicode version of the
    normalization data (15.0.0); characters assigned later pass through
    unchanged. Every line of the Unicode file NormalizationTest.txt also
    checks the new functions.

Changed

  • LandrixXmlDouble: integers below 10^15 (below 10^7 for xs:float) are
    converted to a double directly instead of through a big-integer
    division; the result is the same. An XPath comparison such as
    cl[@id = 15], which converts every @id and the integer this way,
    is about five times faster.
  • LandrixXmlXPathEval: a child step name[@attribute = value] whose
    value does not depend on the focus (a literal, a variable, a path from
    document()) finds its matches through an index of the children by
    that attribute, built on first use per parent with at least 16 such
    children, if the values are strings or untypedAtomic. The Factur-X
    code list checks (.../cl[@id=N]/enumeration[@value=$v]) no longer
    scan the list. Together with the faster integer conversion the
    Factur-X 1.09.2 EXTENDED rules take about 40 % of the time before.
  • XML Schema validation is faster on large documents, with the same
    results: the content model finds the particles that can take a child
    through a name table and bit sets instead of comparing names; values,
    identity constraint keys, error paths and type names are built only
    where they are used; white space normalization returns the value
    itself when nothing changes; text the validator does not look at is
    no longer copied. A 50 MB GAEB DA XML 3.3 file (X83) takes about two
    thirds of the time before.
  • LandrixXmlXsdValidator: the record TLandrixXmlXsdFrame, documented as
    internal, has PathIndex instead of PathStep.

Fixed

  • XML Schema content models: of the configurations a child leaves, those
    another one covers (same position, counts no higher and already at
    their lower bounds) are dropped. Nested repetitions such as
    (a+){1,100000000} in a repeated choice no longer stop with xecLimit
    "Content model too ambiguous to check" after a minute; the three XSTS
    tests particlesZ036_b1, _b2 and _c pass, and the whole XSTS run
    takes 45 seconds instead of 4.5 minutes.
  • LandrixXmlNormalize: an input or a result of more than MaxInt code
    points raises xecLimit instead of overflowing the Integer
    arithmetic (64-bit only).
  • LandrixXmlDom: copies names without Move. FPC 3.2.4 on aarch64-darwin
    reported note 6058 ("Move ... marked as inline is not inlined") there in
    the builds of some consuming projects, despite {$WARN 6058 OFF}.

LandrixXml 0.3.0

Choose a tag to compare

@landrix landrix released this 10 Nov 16:08

Native XML Schema and Schematron validation for Delphi 6 to 13 and Free Pascal 3.2+, as optional units. The reader, writer, DOM and conversion units of 0.2.0 do not depend on them and keep their API.

Highlights

  • XML Schema 1.0 validation (LandrixXmlXsdTypes, LandrixXmlXsdContent, LandrixXmlXsdSchema, LandrixXmlXsdSchemaLoader, LandrixXmlXsdValidator) for the reader and the DOM. It follows Xerces in the Java runtime, the validator behind KoSIT and Mustang: the same verdicts, error codes, messages and order. The deliberate differences from the specification are listed in the README. W3C XML Schema Test Suite: 39,225 of 39,336 applicable tests pass.
  • XPath 2.0 and Schematron (LandrixXmlXPathTree, LandrixXmlXPath, LandrixXmlXPathEval, LandrixXmlSchematron, LandrixXmlSchematronCompiler). XPath runs in two profiles: as the specification says, or as Saxon HE runs it. Schematron rules load directly from .sch and write SVRL. EN16931, XRechnung, Peppol BIS and Factur-X give the same results as the KoSIT validator with Saxon (KoSIT test suite: 86 of 86 equal).
  • Building blocks:
    • exact decimal arithmetic (LandrixXmlDecimal);
    • xs:double and xs:float in software (LandrixXmlDouble);
    • XSD and XPath regular expressions (LandrixXmlRegex);
    • Unicode categories and normalization (LandrixXmlUnicode, LandrixXmlNormalize);
    • SHA-256 (LandrixXmlSha256).

Still only SysUtils, Classes and Contnrs; no IDE packages, add source/ to the search path.

See CHANGELOG.md for the full list of additions, changes and fixes.