2012-03-30 2 views
0

Ich rufe eine C# -Funktion von XSLT in Umbraco 4.7.1. Meine Funktion gibt den Wert der Eigenschaft "tag" auf dem aktuellen Knoten zurück, Problem ist, dass meine Ausgabe codiert ist.Umbraco Call C# in XSLT, dekodieren fXML-Ausgabe

In xsltExtensions.config habe ich eine Assembly-Erweiterung hinzugefügt.

In meiner XSLT Ich erhalte den Wert meiner Funktion

<xsl:value-of select="TagHelpers:ShowAllTags()" /> 

Mein C# Funktion:

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(); 

Meine Ausgabe wie folgt aussieht:

% 3c% 3fxml + Version% 3d% 221.0% 22% 3f% 3e% 0d% 0a% 3cClientValue + xmlns% 3axsd% 3d% 22http% 3a% 2f% 2www.w3.org% 2f2001% 2fXMLSchema% 22 + xmlns% 3axsi% 3d% 22http% 3a% 2f% 2fwww.w3.org% 2f2001% 2fXMLSchema-Instanz % 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

Aber sollte sein:

fritidsjob, jobpatrulje, lo

Antwort

0

Sie können disable-output-Codierung durch Hinzufügen der Codierung loszuwerden = "yes", um Ihre xslt auswählen, zB <xsl:value-of select="TagHelpers:ShowAllTags()" disable-output-encoding="yes" />

Es sieht jedoch so aus, als ob Ihre Tags als XML gespeichert werden und nicht als kommagetrennte Zeichenfolge. Welches Tag-Steuerelement verwenden Sie?