'
引用由解析XSLT的XML解析器解析。您的XSLT處理器從不會看到它們。你的XSLT處理器看到的是:
concat('url('', $imgSrc, '')')
因爲逗號不分離參數的正確的地方結束了這是無效的。然而,這可能爲你工作,你depending on the serializer XSLT處理器使用:
concat("url('", $imgSrc, "')")
這周圍的參數在雙引號,這樣你的單引號不衝突。 XSLT處理器應該看到這一點:
concat("url('", $imgSrc, "')")
另一種選擇是定義一個變量:
<xsl:variable name="apos" select='"'"'/>
哪可以這樣使用:
concat('url(', $apos, $imgSrc, $apos, ')')
更多here:
When you apply an XSLT stylesheet to a document, if entities are declared and referenced in that document, your XSLT processor won't even know about them. An XSLT processor leaves the job of parsing the input document (reading it and figuring out what's what) to an XML parser; that's why the installation of some XSLT processors requires you to identify the XML parser you want them to use. (Others include an XML parser as part of their installation.) An important part of an XML parser's job is to resolve all entity references, so that if the input document's DTD declares a cpdate entity as having the value "2001" and the document has the line "copyright &cpdate; all rights reserved", the XML parser will pass along the text node "copyright 2001 all rights reserved" to put on the XSLT source tree.
這不是一個說法? - >'url(''我認爲它會轉換爲「url('」 – 2011-02-23 16:09:56
)我的眼球第一次解析錯了,請參閱我的更新回答 – 2011-02-23 16:39:03
真的很有用!謝謝。 – 2011-02-23 16:49:55