Description Usage Arguments Value Author(s) References See Also Examples
These functions allow us to query the XSL transformation context to
get a reference object in R to the style sheet DOM, the input XML
document of the XSL transformation, or the output DOM being
constructed.. This allows us then to use XPath expressions to
access different nodes within these documents, identifying templates
in the XSL document, or getting nodes and node sets for use in R
calculations to create output in the target document. These allow
us to manipulate all of the inputs from within R rather than relying
on XSL operations and can be used from within an R function called
by an XSL template. Such functions need to the XMLXPathParserContext
object associated with the XSL transformation. This is passed as the
first argument for any R function which has an S3 class named
XSLTContextFunction
.
1 2 3 | xsltGetStyleSheet(ctx)
xsltGetInputDocument(ctx)
xsltGetOutputDocument(ctx)
|
ctx |
the |
An object of class
XMLInternalDocument
which can be used in calls to
getNodeSet
and whose root node can be accessed
with xmlRoot
and the resulting tree navigated.
Duncan Temple lang
getNodeSet
addXSLTFunctions
xsltContextFunction
.
For an example, see applyTemplates.R, applyTemplates.xsl and applyTemplates.xml.
1 2 3 4 5 6 7 8 9 10 | # Find the XML and XSL files.
files = sapply(c("applyTemplates.xml", "applyTemplates.xsl"),
function(i)
system.file("examples", i, package = "Sxslt"))
z = xsltApplyStyleSheet(files[1], files[2])
saveXML(z$doc)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.