我有一個字符串,其中包含一組文件名,例如;可以在一組字符串標記上創建XSLT鍵嗎?
"foo.jpg,bar.jpg"
我將其傳遞給XSL樣式表;
<xsl:param name="images"/>
我可以以某種方式在這些文件名上創建XSLT密鑰嗎?
我試過這個;
<xsl:variable name="tokens" select="str:tokenize($images, ',')"/>
<xsl:key name="mykey" match="$tokens/*" use="token"/>
但我得到一個錯誤;
Warning: XSLTProcessor::importStylesheet(): compilation error: file
file:///C:/root/sites/bec/ line 105 element key
in C:\root\php\lib-2013-04-23.php on line 157
Warning: XSLTProcessor::importStylesheet(): xsl:key : XPath pattern
compilation failed '//$tokens/*'
我使用PHP的libxml(版本2.7.3)XSLT 1.0禮貌。
感謝一個非常明確和詳細的解答。 –