Skip to content

wamuir/go-xslt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-xslt

Go Reference Build Status codecov Go Report Card

Description

go-xslt is a Go module that performs basic XSLT 1.0 transformations via Libxslt.

Installation

You'll need the development libraries for libxml2 and libxslt, along with those for liblzma and zlib. Install these via your package manager. For instance, if using apt then:

sudo apt install libxml2-dev libxslt1-dev liblzma-dev zlib1g-dev

This module can be installed with the go get command:

go get -u github.com/wamuir/go-xslt

Usage

  // style is an XSLT 1.0 stylesheet, as []byte.
  xs, err := xslt.NewStylesheet(style)
  if err != nil {
      panic(err)
  }
  defer xs.Close()

  // doc is an XML document to be transformed and res is the result of
  // the XSL transformation, both as []byte. 
  res, err := xs.Transform(doc)
  if err != nil {
      panic(err)
  }