Description Usage Arguments Value Author(s) See Also Examples
This function allows an R function that is called
(directly or indirectly) from an XSL template
to query the XSL engine for the names of the top-level
XSL parameters in effect.
These parameters include those explicitly specified
by the caller of the XSL processor as well as those
defined within the XSL stylesheets.
This provides one way of exploring
the parameters defined in a collection of XSL stylesheets.
(We can also parse the XSL document, follow the <import>
and include
nodes and then find the top-level <xsl:param>
elements.
1 |
ctx |
an object of clas |
A character vector giving the names of the XSL parameters.
Duncan Temple Lang
registerXSLFunction
xsltContextFunction
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | fun = function(ctxt, ...) {
params = xslGlobalParameterNames(ctxt)
vals = getXSLVariables(ctxt, params)
print(params)
print(vals)
paste(params, vals, sep = " = ", collapse = ", ")
}
xsl = '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:r="http://www.r-project.org"
extension-element-prefixes="r"
version="1.0">
<xsl:param name="globalParam" select="1"/>
<xsl:template match="/">
Global Parameters: <xsl:value-of select="r:foo()"/>
</xsl:template>
</xsl:stylesheet>
'
xml = '<article/>'
addXSLTFunctions("foo" = xsltContextFunction(fun))
xsltApplyStyleSheet(xml, xsl, who = "'duncan'", depth = 2L, bob = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.