ropensci / xslt

Extension of xml2 package for xsl transformations
https://docs.ropensci.org/xslt
27 stars 1 forks source link

Please add to documentation: params in xml_xslt must be coerced to type character #14

Open AlanInTsukuba opened 3 months ago

AlanInTsukuba commented 3 months ago

In trying to add parameters to xml_xslt, I learned that the params list must be coerced to type character.

To supply a value for the parameter 'viafrversion' in the xslt stylesheet,

<xsl:param name="version" />

the following R code generates an error:

v <-list(version=utils::packageVersion(pkg))
result <- xslt::xml_xslt(xml, xslt,  params =v )

The following code works:

v <-list(version=as.character(utils::packageVersion(pkg)))
result <- xslt::xml_xslt(xml, xslt,  params =v )