I have created a custom field type that renders the input as an html link. The xsl transform that creates the link tag should prepend the user input with a base url from an xsl parameter. I want this prefix to be passed in when the transform is applied so it isn’t hardcoded in the file and can be changed by the user. I believe it can be done by creating a custom web part and then adding this web part to all the pages where you want this to appear (e.g. helpmeonsharepoint). I would like to pass in a parameter in general regardless of which web part the xslt transform is applied to.
I can get this working in a console app which I achieved by following these instructions however I can’t transfer this into SharePoint. I tried simply passing in a c# object shown in the following code snippet:
<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema"
…
xmlns:helper="SampleApplication.ClassName">
<xsl:template name="fldTypes" … >
<span>
<a>
<xsl:attribute name="href">
<xsl:value-of select="helper:ConcatUrl($DocId)"/>
</xsl:attribute>
<xsl:value-of select="$DocId"/>
</a>
</span>
</xsl:template>
When the transform gets applied however I keep getting the following error: “Cannot find the script or external object that implements prefix ‘SampleApplication.ClassName’”. Comparing this to the console app it seems that I am missing the part where I pass in the object by modifying the Xslt Argument List via the AddExtensionObject Method. However, I’m not sure where this code should go if I don’t use a web part. Is this heading in the right direction?