Copied to clipboard

Flag this post as spam?

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


  • Peder Jensen 16 posts 36 karma points
    Jan 21, 2010 @ 09:29
    Peder Jensen
    0

    Error: Error parsing XSLT file

    Yesterday i made this xslt file, and it takes a image and links it to a PDF page.

     

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
     version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:msxml="urn:schemas-microsoft-com:xslt"
     xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
     exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">

    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:param name="currentPage"/>
    <xsl:template match="/">
    <!-- are both these properties filled in?  We don't want to get an error -->
    <xsl:if test="string($currentPage/data [@alias='Product1Link']) != '' and string($currentPage/data [@alias='Product1Picture']) != '' ">
     <a href="{umbraco.library:GetMedia($currentPage/data [@alias='Product1Link'])/data [@alias='umbracoFile']}">
      <img alt="Product">
       <xsl:attribute name="src">
        <xsl:value-of select="umbraco.library:GetMedia($currentPage/data [@alias='Product1Picture'])/data [@alias='umbracoFile']" />
       </xsl:attribute>
      </img>
     </a>
    </xsl:if>
    </xsl:template>
    </xsl:stylesheet>

     

    But when i call it from the macro, it gives me this error on my page, where the picture shoud be:

    Error parsing XSLT file: \xslt\AddData.xslt

     

    This is the line that i use in my template:

    <td width="125" height="150">
       <umbraco:Macro Alias="AddData" runat="server"></umbraco:Macro>
    </td>

     

    I hope you can help me.

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Jan 21, 2010 @ 09:50
    Dirk De Grave
    0

    HI Peder,

    Can't really see an error in your xslt, do you get output when using the xslt visualizer? And what do you get if you add

    <xsl:copy-of select="$currentPage" />

    (May have to look at the source of the page to see the actual xml)

     

    Cheers,

    /Dirk

  • Peder Jensen 16 posts 36 karma points
    Jan 21, 2010 @ 09:58
    Peder Jensen
    0

    I get this error then i use the visualizer, but i dont know if i do it right, i marked all the text and click on the visualizer, and choose the content page where the link shoud be.

    Error parsing the XSLT:

    System.Xml.Xsl.XslTransformException: Extension object 'urn:umbraco.library' does not contain a matching 'GetMedia' method that has 1 parameter(s). at System.Xml.Xsl.Runtime.XmlExtensionFunction.Bind() at System.Xml.Xsl.Runtime.XmlExtensionFunctionTable.Bind(String name, String namespaceUri, Int32 numArgs, Type objectType, BindingFlags flags) 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.macro.GetXsltTransformResult(XmlDocument macroXML, XslCompiledTransform xslt, Dictionary`2 parameters) at umbraco.presentation.umbraco.developer.Xslt.xsltVisualize.visualizeDo_Click(Object sender, EventArgs e)

     

  • Kenneth Solberg 226 posts 417 karma points
    Jan 21, 2010 @ 10:05
    Kenneth Solberg
    2

    GetMedia takes two arguments. Second is bool Deep.

  • Peder Jensen 16 posts 36 karma points
    Jan 21, 2010 @ 10:24
    Peder Jensen
    0

    I am new to umbraco, so i dont now what you mean, do you have a link i can look at ?

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Jan 21, 2010 @ 10:32
    Dirk De Grave
    1

    Signature of GetMedia() method:

    XPathNodeIterator GetMedia(int nodeId, bool deep);

    You can either get a media item for a single node (returns a XPathNodeIterator with just a single node) or for a node and all childnodes (deep=true())

    <xsl:value-of select="umbraco.library:GetMedia($currentPage/data [@alias='Product1Picture'])/data [@alias='umbracoFile'], false()" />

     

    Cheers,

    /Dirk

     

  • Peder Jensen 16 posts 36 karma points
    Jan 21, 2010 @ 10:46
    Peder Jensen
    0

    Ok so what i have to do is to change:

    <xsl:value-of select="umbraco.library:GetMedia($currentPage/data [@alias='Product1Picture'])/data [@alias='umbracoFile']" />

    to

    <xsl:value-of select="umbraco.library:GetMedia($currentPage/data [@alias='Product1Picture'])/data [@alias='umbracoFile'], false()" />

     

    but i am a little confused, where do i put in this line in my xslt ? i have tryed to look on the forum but cant find it.

    XPathNodeIterator GetMedia(int nodeId, bool deep);
  • Peder Jensen 16 posts 36 karma points
    Jan 21, 2010 @ 11:14
    Peder Jensen
    0

    I tryed to change my xslt to this, but i still get the error on my page.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
     version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:msxml="urn:schemas-microsoft-com:xslt"
     xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
     exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">

    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:param name="currentPage"/>
    <xsl:template match="/">
    <!-- are both these properties filled in?  We don't want to get an error -->
    <xsl:if test="string($currentPage/data [@alias='Product1Link']) != '' and string($currentPage/data [@alias='Product1Picture']) != '' ">
     <a href="{umbraco.library:GetMedia($currentPage/data [@alias='Product1Link'])/data [@alias='umbracoFile']}">
      <img alt="Product">
       <xsl:attribute name="src">
        <xsl:value-of select="umbraco.library:GetMedia($currentPage/data [@alias='Product1Picture'], 'false')/data [@alias='umbracoFile']" />
       </xsl:attribute>
      </img>
     </a>
    </xsl:if>
    </xsl:template>
    </xsl:stylesheet>
  • Kenneth Solberg 226 posts 417 karma points
    Jan 21, 2010 @ 13:44
    Kenneth Solberg
    0

    Product1Link is still missing the 2nd argument to GetMedia ...

  • Peder Jensen 16 posts 36 karma points
    Jan 21, 2010 @ 14:12
    Peder Jensen
    0

    This is not because, i want yoo to tell me it all, but do you now where i can find an explanation or an excample ?

    i have tryed to find it, but i cant find it.

    But anyway thanks for the help :)

     

  • Peder Jensen 16 posts 36 karma points
    Jan 21, 2010 @ 15:13
    Peder Jensen
    0

    I got it to work :) and thanks but i just have one more thing, the link is working, but there is some numbers above it, how do i rid of them ?

     

    But big thanks to Kenneth and Dirk.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies