Umbraco 4.7.1のXSLTからC#関数を呼び出しています。私の関数は現在のノードの「tag」プロパティの値を返しています。問題は出力がエンコードされていることです。
xsltExtensions.configに、アセンブリ拡張機能を追加しました。
XSLTで、関数の値を取得しています
<xsl:value-of select="TagHelpers:ShowAllTags()" />
私のC#関数:
public string ShowAllTags()
{
var node = new DynamicNode(Node.GetCurrent());
var html = new StringBuilder();
if (node.HasProperty("tags"))
{
var tagList = node.GetPropertyValue("tags");
if(tagList.Length > 0)
{
foreach (var tag in tagList)
{
html.Append(HttpUtility.HtmlEncode(tag));
}
}
}
return html.ToString();
私の出力は次のようになります:
%3c%3fxml + version%3d%221.0%22%3f%3e%0d%0a%3cClientValue + xmlns%3axsd%3d%22http%3a%2f%2fwww.w3.org%2f2001%2fXMLSchema%22 + xmlns%3axsi %3d%22http%3a%2f%2fwww.w3.org%2f2001%2fXMLSchema-instance%22%3e%0d%0a ++%3cTags%3e%0d%0a ++++%3cstring%3efritidsjob%3c%2fstring%3e%0d%0a ++++ %3cstring%3elo%3c%2fstring%3e%0d%0a ++++%3cstring%3ejobpatrulje%3c%2fstring%3e%0d%0a ++%3c%2fTags%3e%0d%0a ++%3cGroupName%3edefault%3c%2fGroupName%3e%0d %0a%3c%2fClientValue%3e
しかし、次のようにする必要があります。
fritidsjob、jobpatrulje、lo