Title: | Extensible Style-Sheet Language Transformations |
---|---|
Description: | An extension for the 'xml2' package to transform XML documents by applying an 'xslt' style-sheet. |
Authors: | Jeroen Ooms [aut, cre] |
Maintainer: | Jeroen Ooms <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.4.6 |
Built: | 2024-11-02 05:58:20 UTC |
Source: | https://github.com/ropensci/xslt |
Transform an XML document by applying an XSL stylesheet. Usually returns the
transformed xml_document, unless the stylesheet has
<xsl:output method="text">
in which case we return a text string.
xml_xslt(doc, stylesheet, params) xslt_version()
xml_xslt(doc, stylesheet, params) xslt_version()
doc |
xml document as returned by xml2::read_xml |
stylesheet |
another xml document containing the XSL stylesheet |
params |
named list or vector with additional XSLT parameters |
This implementation supports XSLT 1.0 features plus most of the EXSLT set of processor-portable extensions functions. Unfortunately XSLT 2.0 or 3.0 features are only available in proprietary libraries and currently unsupported. However XSLT 2.0 is not widely adopted anyway because it is unavailable in most browsers.
doc <- read_xml(system.file("examples/cd_catalog.xml", package = "xslt")) style <- read_xml(system.file("examples/cd_catalog.xsl", package = "xslt")) html <- xml_xslt(doc, style) cat(as.character(html))
doc <- read_xml(system.file("examples/cd_catalog.xml", package = "xslt")) style <- read_xml(system.file("examples/cd_catalog.xsl", package = "xslt")) html <- xml_xslt(doc, style) cat(as.character(html))