XMLCompiledTransform で使用するために msxml:script を使用する XSL スクリプトを作成しましたが、それを必要とする人々は、そのスクリプトは Linux/Perl 環境では機能しないと言っていました (これは文字通り、彼らが XSL をどのように使用しているかについて私が知っている限りです。 ) 「Microsoft 固有の拡張機能を使用している」ためです。そこで、xsl:script を使用して XSL をより中立なものにしようとしています。しかし、私はそれを機能させるのに苦労しています。
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:theScript="urn:CustomScript" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" exclude-result-prefixes="xsl theScript fo xs fn">
<xsl:output method="xml" indent="yes" version="1.0" encoding="utf-8" omit-xml-declaration="no"/>
<xsl:script language="javascript" implements-prefix="theScript">
<![CDATA[
function test() {return "test"; }
]]>
</xsl:script>
<xsl:template match="/">
<test>
<xsl:value-of select="theScript:test()" />
</test>
</xsl:template>
</xsl:stylesheet>
上記では、「接頭辞 'urn:CustomScript' を実装するスクリプトまたは外部オブジェクトが見つかりません」というエラーが表示されます。
それを取り除くとxmlns:theScript="urn:CustomScript"
、「Prefix 'theScript' is not defined.」というエラーが表示されます。
また、「theScript」プレフィックスのすべての痕跡を削除して使用しようとしましimplements-prefix="local"
たが、それも機能しません。test
不明な XSLT 関数であることがわかります。
ここで何か間違ったことをしているだけですか、それとも XMLCompiledTransform はサポートしていませんxsl:script
か?