xsltApplyStyleSheet | R Documentation |
From within R, this applies the rules in the specified
stylesheet to the given XML document given either
as the name of a file/URI, string containing
the XML, or an internal DOM constructued
using xmlTree
and creates a new document as a result of the transformation.
xsltApplyStyleSheet(fileName, sheet,
isURL = length(grep("^(http|ftp)", fileName)) > 0,
xinclude = TRUE, ..., .params = character(0),
.profile = FALSE, .merge = TRUE,
.errorFun = xmlErrorCumulator("XSLErrorList"))
fileName |
the name of the file containing the XML document to process or alternatively a string containing the XML content directly. |
sheet |
the |
isURL |
a logical value indicating whether the |
... |
any number of |
.params |
an alternative mechanism to the ... for specifying
the parameters. This is a named character vector giving the
|
xinclude |
a logical value indicating whether to enable XInclude support during the processing of the XML document. |
.profile |
a logical value, a string or a function indicating that profiling
of the XSL operations should be done and the results returned as a
data frame (via |
.merge |
either a string or a logical value that controls
whether the function searches for an XSL style sheet within the
XML document itself and uses that along with any style sheet
specified via the If a style sheet is used from the input XML document,
any style sheet specified via the If more contol is needed over how the style sheets are merged, see
|
.errorFun |
an R function (or |
An object of class XMLInternalXSLTDocument
which has three slots:
doc |
a reference to the native (C-level) XML document. |
stylesheet |
a reference to the native (C-level) XSLT stylesheet used to process the original document. This is needed to serialize the newly created document. |
status |
an integer value which is either
an |
Duncan Temple Lang <duncan@wald.ucdavis.edu>
http://www.omegahat.org/Sxslt, http://www.omegahat.org/SXalan, http://www.w3.org/Style/XSL http://xmlsoft.org/XSLT htt
saveXML
xsltParseStyleSheet
files = sapply(c("sqrt.xml", "sqrt.xsl"), function(f) system.file("examples", f, package = "Sxslt"))
doc <- xsltApplyStyleSheet(files[1], files[2])
sheet <- xsltParseStyleSheet(system.file("examples", "params.xsl", package="Sxslt"))
doc <- xsltApplyStyleSheet("<?xml version='1.0' ?><doc></doc>\n", sheet, isURL= FALSE, myParam="'foo'")
# Using the style sheet within the input XML document.
f = system.file("examples", "embeddedXSL.xml", package = "Sxslt")
z = xsltApplyStyleSheet(f , .merge = "html")
## Not run:
segments = xsltParseStyleSheet(path.expand("~/Projects/org/omegahat/XML/Literate/segment.xsl"))
doc <- xsltApplyStyleSheet(path.expand("~/Projects/org/omegahat/XML/Literate/examples/functionParts.xml"),
segments, isURL = FALSE)
saveXML(doc)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.