library(xml2)
library(xslt)
xml_src <- "<test/>"
xslt_src <- '<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<article>
<title>Hello World</title>
</article>
</xsl:template>
</xsl:stylesheet>'
doc <- read_xml(xml_src)
xsl <- read_xslt(xslt_src)
res <- xslt_transform(doc, xsl)
cat(as.character(res))
res <- xslt_transform(xslt_src, xslt_src)
cat(as.character(res))
Run the code above in your browser using DataLab