我在iOS上使用libxslt,并且我从简单的xslt中得到编译错误,例如:
compilation error: file /Users/yada/Library/Developer/CoreSimulator/Devices/ACE15E20-3230-4966-ACDE-DCADABF48B32/data/Containers/Bundle/Application/A4EC9B34-3A96-42E0-B58F-6EB44C942874/appname.app/upconversion-options.xsl line 19 element function
xsltStylePreCompute: unknown xsl:function
compilation error: file /Users/yada/Library/Developer/CoreSimulator/Devices/ACE15E20-3230-4966-ACDE-DCADABF48B32/data/Containers/Bundle/Application/A4EC9B34-3A96-42E0-B58F-6EB44C942874/appname.app/upconversion-options.xsl line 20 element param
element param only allowed within a template, variable or param
......还有更多这样的事情,当我这样做时:
xmlSubstituteEntitiesDefault(1);
xmlLoadExtDtdDefaultValue = 1;
NSString * pMathMLTocMathMLXSLPath = [[NSBundle mainBundle] pathForResource:@"upconversion-options" ofType:@"xsl"];
xsltStylesheetPtr pMathMLTocMathMLXSLStyleSheet = xsltParseStylesheetFile((const xmlChar *)[pMathMLTocMathMLXSLPath cStringUsingEncoding:NSUTF8StringEncoding]);
xsl文件如下所示:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:s="http://www.ph.ed.ac.uk/snuggletex"
xmlns="http://www.w3.org/1998/Math/MathML"
exclude-result-prefixes="xs s"
xpath-default-namespace="http://www.w3.org/1998/Math/MathML">
<xsl:function name="s:get-boolean-option" as="xs:boolean">
<xsl:param name="upconversion-options" as="element(s:upconversion-options)"/>
<xsl:param name="name" as="xs:string"/>
<xsl:sequence select="boolean($upconversion-options/s:option[@name=$name]/@value='true')"/>
</xsl:function>
<xsl:function name="s:get-upconversion-option" as="xs:string?">
<xsl:param name="upconversion-options" as="element(s:upconversion-options)"/>
<xsl:param name="name" as="xs:string"/>
<xsl:sequence select="$upconversion-options/s:option[@name=$name]/@value"/>
</xsl:function>
<xsl:function name="s:get-symbol-assumption" as="element(s:symbol)?">
<xsl:param name="element" as="element()"/>
<xsl:param name="upconversion-options" as="element(s:upconversion-options)"/>
<xsl:sequence select="$upconversion-options/s:symbol[deep-equal(*, $element)]"/>
</xsl:function>
<xsl:function name="s:is-assumed-symbol" as="xs:boolean">
<xsl:param name="element" as="element()"/>
<xsl:param name="upconversion-options" as="element(s:upconversion-options)"/>
<xsl:param name="assume" as="xs:string"/>
<xsl:sequence select="exists($upconversion-options/s:symbol[@assume=$assume and deep-equal($element, *)])"/>
</xsl:function>
<xsl:function name="s:is-assumed-function" as="xs:boolean">
<xsl:param name="element" as="element()"/>
<xsl:param name="upconversion-options" as="element(s:upconversion-options)"/>
<xsl:sequence select="s:is-assumed-symbol($element, $upconversion-options, 'function')"/>
</xsl:function>
</xsl:stylesheet>
有什么建议吗?