Concatenate with escaped chars in xslt? -


i'm writing xslt code concatenates string:

<xsl:attribute name='src'>     <xsl:value-of select="concat('url(&apos;', $imgsrc, '&apos;)')" /> </xsl:attribute> 

for reason can't use it, keep getting error:

unknown function - name , number of arguments not match function signature in static context - 'http://www.w3.org/2005/xpath-functions:concat'

while evaluating expression: select="concat('url(&apos;', $imgsrc, '&apos;)')"

any idea?

thx

====================

edit

i'm trying get:

url('some_path') 

was having trouble apostrophes, doesn't work.

the &apos; references resolved xml parser parses xslt. xslt processor never sees them. xslt processor sees is:

concat('url('', $imgsrc, '')')  

which not valid because commas don't end in right place separate arguments. however, might work you, depending on serializer xslt processor uses:

concat(&quot;url('&quot;, $imgsrc, &quot;')&quot;) 

this surrounds arguments in double-quotes, single-quotes not conflict. xslt processor should see this:

concat("url('", $imgsrc, "')") 

another option define variable:

<xsl:variable name="apos" select='"&apos;"'/> 

which can used this:

 concat('url(', $apos, $imgsrc, $apos, ')') 

more here:

when apply xslt stylesheet document, if entities declared , referenced in document, xslt processor won't know them. xslt processor leaves job of parsing input document (reading , figuring out what's what) xml parser; that's why installation of xslt processors requires identify xml parser want them use. (others include xml parser part of installation.) important part of xml parser's job resolve entity references, if input document's dtd declares cpdate entity having value "2001" , document has line "copyright &cpdate; rights reserved", xml parser pass along text node "copyright 2001 rights reserved" put on xslt source tree.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -