Coder Social home page Coder Social logo

ratago's Introduction

ratago

Build Status codecov Go Report Card GoDoc

Ratago is a (mostly-compliant) implementation of an XSLT 1.0 processor written in Go and released under an MIT license.

Currently it should be seen as experimental - it lacks full compliance with the spec. It has been run successfully on a number of scripts of moderate complexity as of the 0.4-pre release.

The test suite is derived from the test suite used by the libxslt library written by Daniel Veillard. See http://xmlsoft.org/XSLT/ for details on libxslt.

Installation

For MacOS:

# Need pkg-config, see https://stackoverflow.com/a/36794452/700471
brew install pkg-config 
# Need libxml2 source, see https://github.com/mitmproxy/mitmproxy/issues/68#issuecomment-120301708
brew install libxml2
sudo ln -s /usr/local/opt/libxml2/include/libxml2/libxml /usr/local/include/libxml 
# Install with Go Modules
GO111MODULE=on go get github.com/jbowtie/ratago

Example Usage

ratago -indent transform.xslt data.xml > result.xml

TODO

There are several tasks remaining to reach full compliance. Until these tasks are complete the API is subject to change.

  • Implement xsl:decimal-format and format-number.
  • Ensure that errors are properly progogated in Go fashion.

ratago's People

Contributors

jbowtie avatar jbuchbinder avatar kivutar avatar tooolbox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ratago's Issues

Implement unparsed-entity-uri

Tested by general/bug-21-.xsl

This will need to get an NDATA ENTITY declared in the DTD from Gokogiri somehow; most likely we'll need an upstream patch to expose xmlGetDocEntity().

namespace declarations do not appear in deterministic order in output

Technically this isn't really an issue - the output is correct according to the XML spec - but it causes several tests to fail seemingly at random.

For example, see REC/test-7.1.1 (which is currently disabled pending investigation into this issue).

Making the test harness smart enough to recognise XML output and do canonicalization first would be a reasonable fix. Alternatively, sorting by prefix before writing (and fixing up the associated expected output) would be another way to fix it.

Fatal errors when running

More of a question than a bug. I'm trying to use this package in a project and get the following error when running go run *.go:

toby:go-xml-to-csv robert$ go run *.go
^[^[# github.com/jbowtie/gokogiri/help
../../go/src/github.com/jbowtie/gokogiri/help/help.go:6:10: fatal error: 'libxml/tree.h' file not found
#include <libxml/tree.h>
         ^~~~~~~~~~~~~~~
1 error generated.
# github.com/jbowtie/gokogiri/xpath
../../go/src/github.com/jbowtie/gokogiri/xpath/expression.go:4:10: fatal error: 'libxml/xpath.h' file not found
#include <libxml/xpath.h>
         ^~~~~~~~~~~~~~~~
1 error generated.

Do I need to do some kind of configuration with cgo to get things building/running? The gokogiri doc says to apt-get libxml2-dev; I've installed libxml2 via brew since I'm on os x (no libxml2-dev package was known to brew).

Need tests for EXSLT math functions

The newly added EXSLT math functions need some test coverage.

Small test cases patterned after the other tests in stylesheet_test.go are best (see TestNaive for a template).

document('') should resolve to the stylesheet

This should already be implemented, however it seems to fail. This may require additional manipulation of the XPathContext. Tests general/array.xsl and general/bug-38-.xsl rely on this function.

Some tests fail due to attribute order

Technically we should only compare documents after canonicalization, which renders attribute order moot. Practically we need to determine why only a tiny subset of tests are affected by attribute order, none of which used to be.

How does StripSpace work

Hey @jbowtie this XSLT library looks good. I have been using it today :)

Can you please show me an example of how StripSpace and indentation works ?

Thanks ๐Ÿ‘

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.