VEZY / XSLT.jl

A Julia wrapper to libxslt to apply a stylesheet to an XML file

Home Page:https://vezy.github.io/XSLT.jl/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

XSLT

Stable Dev Build Status

Transform XML documents to any other document type using XSLT stylesheets.

This is a Julia wrapper for the libxslt library.

XSLT.jl is fully compatible with EzXML.jl and LightXML.jl, so you can use it to transform XML documents to HTML, JSON, etc...

Installation

The package can be installed with the Julia package manager. From the Julia REPL, type ] to enter the Pkg REPL mode and run:

pkg> add XSLT

Or, equivalently, via the Pkg API:

julia> import Pkg; Pkg.add("XSLT")

Example usage: transform XML to HTML

Using file paths directly (no further dependency)

julia> using XSLT

julia> xml_file = joinpath(dirname(pathof(XSLT)), "..", "test", "files", "cd_catalog.xml")
julia> xslt_file = joinpath(dirname(pathof(XSLT)), "..", "test", "files", "cd_catalog.xsl")

julia> xml_xslt(xml_file, xslt_file)

Using document pointers (no further dependency either)

julia> using XSLT

julia> xml = read_xml(joinpath(dirname(pathof(XSLT)), "..", "test", "files", "cd_catalog.xml"))
julia> xslt = read_stylesheet(joinpath(dirname(pathof(XSLT)), "..", "test", "files", "cd_catalog.xsl"))

julia> xml_xslt(xml, xslt)

Using EzXML

julia> using XSLT, EzXML

julia> xml = readxml(xml_file)

julia> xml_xslt(xml, xslt_file) |> parsehtml

Using LigthXML

julia> using XSLT, LightXML

julia> xml = parse_file(xml_file)

julia> xml_xslt(xml, xslt_file)

Similar projects

  • libxslt - the C library used by this package
  • xslt R package, from the rOpenSci organization, from which the API name is inspired
  • The different official bindings in other languages:

About

A Julia wrapper to libxslt to apply a stylesheet to an XML file

https://vezy.github.io/XSLT.jl/

License:MIT License


Languages

Language:Julia 93.1%Language:HTML 3.9%Language:XSLT 3.0%