Having problem listing tags in my blogPost. Everything works fine until I type the tag "Tips & Trics". I get the following action on the line: <xsl:for-each select="tagsLib:getTagsFromNode(@id)/tags/tag">
{"An error occurred while parsing EntityName. Line 2, position 51."}
It seems that the "&" in the tag is not appreciated by getTagsFromNode.
If you mean an alternative tagging approach - The company I work for, Conscia, put together a nice tagging datatype... the tag information was stored against the page node. With the accumulated tag count stored in the App context. I'll see if they'll release it this week.
Error in tagsLib:getTagsFromNode
Hi, everyone!
Having problem listing tags in my blogPost. Everything works fine until I type the tag "Tips & Trics". I get the following action on the line:
<xsl:for-each select="tagsLib:getTagsFromNode(@id)/tags/tag">
{"An error occurred while parsing EntityName. Line 2, position 51."}
It seems that the "&" in the tag is not appreciated by getTagsFromNode.
Any ideas?
Best regards,
Christopher W. B.
Try saving the tag as "Tips & Tricks" and it should work.
However this is a work around and no use if website users are entering tags.
Where does the tagsLib extension come from? Basically a change needs to be made to HTMLEncode the tags before outputing.
<Action runat="install" alias="addXsltExtension" assembly="\bin\umbraco.editorControls" type="umbraco.editorControls.tags.library" extensionAlias="tagsLib" />
It is an action I installed. Ok, so I need to encode.. How will I do that? Here is my code (bold line is where VS is stopping me):
<xsl:template name="showpost">
<xsl:param name="post"/>
<div class="post">
<h2 id="post-{$post/@id}"><a href="{umbraco.library:NiceUrl($post/@id)}"><xsl:value-of select="$post/@nodeName"/></a></h2>
<small><xsl:value-of select="umbraco.library:LongDate($post/@createDate)"/> by <xsl:value-of select="$post/@creatorName"/> </small>
<div class="entry">
<xsl:value-of select="$post/data [@alias = 'bodyText']" disable-output-escaping="yes"/>
</div>
<p class="postmetadata">
Archived as
<xsl:for-each select="tagsLib:getTagsFromNode(@id)/tags/tag">
<a href="{umbraco.library:NiceUrl($currentPage/@id)}?filterby={.}"><xsl:value-of select="."/></a>
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each>
<strong>|</strong>
<xsl:choose>
<xsl:when test="count(./node [@nodeTypeAlias = 'BlogPostComment']) = 0">
<a href="{umbraco.library:NiceUrl(@id)}#comments">Leave comment</a>
</xsl:when>
<xsl:when test="count(./node [@nodeTypeAlias = 'BlogPostComment']) = 1">
<a href="{umbraco.library:NiceUrl(@id)}#comments">1 comment</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}#comments"><xsl:value-of select="count(./node [@nodeTypeAlias = 'BlogPostComment'])"/> comments</a>
</xsl:otherwise>
</xsl:choose>
</p>
</div>
</xsl:template>
The problem is that the getTagsFromNode doesn't HTML encode.
If I were you I would implement this again changing the above as follows
.
I would also implement some caching. This tag library is not very efficient, each extension call results in DB access everytime.
Ok, thanks!
I'll just change the tag for now. :-) If I were to change it, would you suggest an override?
An override? Sorry, I don't follow.
If you mean an alternative tagging approach - The company I work for, Conscia, put together a nice tagging datatype... the tag information was stored against the page node. With the accumulated tag count stored in the App context. I'll see if they'll release it this week.
Ok, thanks fo all the input. :-)
I just figured I use the built in datatype for now.
is working on a reply...