Archive
Gotcha: don’t use ‘{$…}’ syntax or ‘$…’ syntax in XSL-XPath’s concat
<xsl:template match="cxml:Item" mode="col">
<xsl:variable name="FILENAME" select="…someXPathQuery…"/>
<xsl:variable name="IMAGE" select="concat(‘http://gallery.clipflair.net/activity/image/’, $FILENAME, ‘.png’)"/>
…
I got confused a bit today after a long day of fiddling with XSL and ClipFlair Activity Gallery’s CXML (Collection XML) data (as used in PivotViewer control), and didn’t understand why I couldn’t use an XSL variable’s (FILENAME in the sample above) calculated value inside the definition of another variable.
That other variable (IMAGE) was using “concat” function of XPath and I was getting a literal string concatenated, instead of the value of the FILENAME one.
After a while I noticed that I was using string quotes arround the respective argument passed to the “concat” function. One needs to use $FILENAME there, not ‘$FILENAME’ and of course not ‘{$FILENAME}’ (the last one is used inside say HTML argument values used for output, like <img href=”{$IMAGE}” />)
Microsoft Expression Blend – learning and community resources
Copying from Expression Blend 4 User Guide’s “Learning and community resources” section:
Apart from this User Guide, the following additional content and resources are available.
Expression Blend and other Expression Studio products
Expression community website (training, tutorials, videos, and webcasts)
Silverlight
System.Windows.Controls Namespace for Silverlight
Windows Presentation Foundation