Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • alexei 21 posts 40 karma points
    Nov 02, 2009 @ 02:04
    alexei
    0

    tagsLib:getContentsWithTags

    I can't get it worked, please help

    xmlns:umbraco.editorControls="urn:umbraco.editorControls"
    ...
    <xsl:for-each select="umbraco.editorControls:getContentsWithTags('tag')">

     

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Nov 02, 2009 @ 09:15
    Thomas Höhler
    2

    A little more informations on what your problem is would help.

    To see what this function returns just use

    <xsl:copy-of select="umbraco.editorControls:getContentsWithTags('tag')" />

    and then take a look into the html code.

    hth, Thomas

  • alexei 21 posts 40 karma points
    Nov 02, 2009 @ 12:57
    alexei
    1

    Hi, Thomas

    the problem is in xslt - I can't save it:

    System.Xml.Xsl.XslTransformException: Cannot find the script or external object that implements prefix 'urn:umbraco.editorControls'. 
    at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args) 
    at (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) 
    at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) 
    at Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) 
    at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results) 
    at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer, Boolean closeWriter) 
    at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results) 
    at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, TextWriter results) 
    at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results) 
    at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)
  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Nov 02, 2009 @ 13:10
    Dirk De Grave
    0

    Alexei, can you show us the xsltExtensions.config from the /config folder?

     

    Looking forward to your info.

     

    Cheers,

    /Dirk

  • alexei 21 posts 40 karma points
    Nov 02, 2009 @ 13:21
    alexei
    0

    Dirk, here it is

    <?xml version="1.0" encoding="utf-8"?>
    <XsltExtensions>
      <ext assembly="\bin\umbraco.editorControls" type="umbraco.editorControls.tags.library" alias="tagsLib" />
      <!--
      <ext assembly="/bin/name-of-dll-without-dll-extension" type=”Fully.Qualified.Name.Of.Type.Including.Namespace” alias=”Prefix-to-use-in-xslt” />
      -->
      <ext assembly="/bin/Designit.Umb.DataTypes.Video" type="Designit.Umb.DataTypes.Video.XsltExtension" alias="Designit.VideoEmbed">
      </ext>
    </XsltExtensions>
  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Nov 02, 2009 @ 14:54
    Dirk De Grave
    0

    Hi Alexei,

    don't you need to add a reference to the tagsLib instead of umbraco.editorControls. Have a look at this wiki page...(Especially on the tagsLib declaration on top of the xslt file)

     

    Hope this helps.

    Regards,

    /Dirk

  • alexei 21 posts 40 karma points
    Nov 02, 2009 @ 15:08
    alexei
    0

    Dirk, thanks

    Give me please one more advice. From getContentsWithTags I got  XpathNodeIterator. How I can get just some data instead of whole node using xslt?

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Nov 02, 2009 @ 15:31
    Dirk De Grave
    0

    Hi Alexei, a quick look at the code reveals the following:

            /// <summary>
            /// Gets all content nodes in Umbraco with the specified tag.
            /// It returns the found nodes as:
            /// <root>
            /// <node><data/>...</node>
            /// <node><data/>...</node>
            /// etc...
            /// </root>
            /// </summary>
            /// <param name="tags">Commaseparated tags.</param>
            /// <returns>
            /// A XpathNodeIterator
            ///</returns>
    

    So, in your code you'll need to use:

    <xsl:for-each select="tagsLib:getContentsWithTags('tag')/node">
    ...
    </xsl:for-each>

     

    Hope this helps.

    Regards,

    /Dirk

     

     

  • alexei 21 posts 40 karma points
    Nov 02, 2009 @ 19:43
    alexei
    0

    Dirk, thanks again for your attention to beginner

    I get it working with code:

    <xsl:for-each select="tagsLib:getContentsWithTags('tag')/root/node">
  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Nov 03, 2009 @ 08:53
    Dirk De Grave
    0

    Hi Alexei,

    Great you're giving feedback on your solution. I seem to have forgotten the root selector from the xpath. For further reference, one may also use:

    <xsl:for-each select="tagsLib:getContentsWithTags('tag')//node">
    ...
    </xsl:for-each>

     

    Cheers,

    /Dirk

     

Please Sign in or register to post replies

Write your reply to:

Draft