My Swift application produces an XMLDocument, which it then transforms using XSLT:
xmlDocument.object(byApplyingXSLTString: xsltString, arguments: nil)
In my XSLT stylesheet (xsltString
), I’d like to access result tree fragments using XPath. This is not supported in XSLT 1.0; I tried using XSLT 2.0, but it doesn’t seem to be supported by Swift; specifying version="2.0"
in the xsl:stylesheet
element produces this error:
xsl:version: only 1.0 features are supported
I think I could use node-set
from EXSLT. I’m not familiar with this, but I tried adding information about EXSLT to the xsl:stylesheet
element. This seems to have no effect:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl"
version="1.0">
I get the following errors:
xmlXPathCompOpEval: function node-set not found
XPath error : Unregistered function
Is it possible to use XSL 2.0 or EXSLT in my situation, and how?