XSLT templating Tcm Script Assistant

By | October 19, 2010

I have to admit I am an XSLT junky. It seems to be useful for almost anything. From transforming Enterprise Architect models to full blown reports or simply adding sequential numbering to data dictionaries. My XSLT skills have proven to be a huge time saver on many occasions. The only flaw in XSLT is its readability.

In a rare bout of regression to my very first project role. I got down and dirty with some of the finer points of the SDL WCMS XSLT Component Templating. Specifically the part of using the Tcm Script Assistant in XSLT. From this experience I would like to share my most valuable lesson learned: Do not forget to cast the xslt node text to a string. Hopefully the code below will prove beneficial for someone running into a similar challenge:

<xsl:template match=”Content:photo”>
<xsl:element name=”=”{local-name()}”>
<xsl:value-of select=”tcmse:PublishBinary(string(@xlink:href))”/>
</xsl:element>
</xsl:template>

The error I received was: “Error occurred during a call to property or method ‘PublishBinary'”

PS do not forget to declare the tcmse namespace: xmlns:tcmse=”http://www.tridion.com/ContentManager/5.1/TcmScriptAssistant”