2009-10-01 92 views
0

即時得到的錯誤,當我嘗試使用以下命令:XSL - 無效XPath擴展的更換

<xsl:variable name="url" select="guid"/>   
<xsl:variable name="vid" select="substring-after($url,'podcast/')"/> 
<xsl:variable name="pre" select="substring-before($vid,'.mp4')"/> 

<<xsl:variable name="p" select="replace($pre,'_','-')"/> 
<xsl:variable name="p1" select="concat($p,'.embed_thumbnail.jpg')"/> 
<xsl:variable name="p2" select="concat('http://images.ted.com/images/ted/tedindex/embed-posters/',$p1)"/> 

任何人都可以看到一個問題,這一切對我來說很好?

回答

1

您使用的是XSLT 1處理器嗎? replace函數出現在XPath 2.0中,因此在XSLT 1中不可用。

在這種情況下,您可以使用translate函數代替。

0

您有一個額外的轉義小於號你p變量的定義之前:

<<xsl:variable name="p" select="replace($pre,'_','-')"/> 

這不是有效的語法。

您應該將其刪除:

<xsl:variable name="p" select="replace($pre,'_','-')"/> 

或者逃避它:

&lt;<xsl:variable name="p" select="replace($pre,'_','-')"/> 
+0

沒有解決問題,但在正確的方向。 – CLiown 2009-10-01 12:21:36

0

我看到了 '< <' 第4行的開始,是嗎?