Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 5 of 5

Thread: ProductLink: What am I doing wrong?

  1. #1
    LPBR is offline Junior Member
    Join Date
    Dec 2011
    Posts
    24

    Default ProductLink: What am I doing wrong?

    Hi, I am desperate and feeling myself the dumbest human being in the world...



    I am trying to do doing things the way MultiStore manual tells me to do (http://manual.aspdotnetstorefront.co...ackages.aspx):

    <xsl:variable name="productid"><xsl:value-of select="SFProductId" disable-output-escaping="yes" /></xsl:variable>
    <xsl:variable name="mylink"><xsl:value-of select="aspdnsf:ProductLink($productid, '', 0)" disable-output-escaping="yes"/></xsl:variable>
    <a href="{$mylink}"><xsl:value-of select="Name" disable-output-escaping="yes" /></a>

    But it doesn't work, instead it crashes my XMLPackage and clearly the problem is in the piece in red, because when I remove it the XMLPackage doesn't crashes.

    When it crashes it asks me to look at error log. Looking at the error log I have:

    Page URL:/Web/t-custom-remaining-parts.aspx
    Source:System.Data.SqlXml
    Message:Cannot find the script or external object that implements prefix 'http://www.DNSF2.com'.
    Stack Trace:
    at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltL ateBoundFunction(String name, String namespaceUri, IList`1[] args)
    at System.Xml.Xsl.CompiledQuery.Query.<xsl:template match="/">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, Double {urn:schemas-microsoft-com:xslt-debug}position, Double {urn:schemas-microsoft-com:xslt-debug}last, IList`1 {urn:schemas-microsoft-com:xslt-debug}namespaces) in C:\AspDotNetStorefront\Web\images\custom.remaining-parts.xml.config_store.runtime.xsl:line 130
    at System.Xml.Xsl.CompiledQuery.Query.<xsl:apply-templates>(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator , Double , Double )
    at System.Xml.Xsl.CompiledQuery.Query.Root(XmlQueryRu ntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    at System.Xml.Xsl.CompiledQuery.Query.Execute(XmlQuer yRuntime {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(IXPathNavigabl e contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results)
    at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigabl e contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, Stream results)
    at System.Xml.Xsl.XslCompiledTransform.Transform(IXPa thNavigable input, XsltArgumentList arguments, Stream results)
    at AspDotNetStorefrontCore.XmlPackage2.TransformStrin g()

    What am I doing wrong????


  2. #2
    mmcgeachy is offline Senior Member
    Join Date
    Sep 2008
    Posts
    174

    Default

    given the error message says can you show your opening xsl:stylesheet tag? I think that is where your issue is. Also are you trying to do a xmlPackage accessible function?

  3. #3
    LPBR is offline Junior Member
    Join Date
    Dec 2011
    Posts
    24

    Default

    mmcgeachy, thank you very much for your post!

    It gave me a clear clue about what the problem could be. Actually I was just using the very same old XMLPackages, and my stylesheet tag was:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aspdnsf="http://www.DNSF2.com">


    Anyway, when I changed it to:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:aspdnsf="urn:aspdnsf">

    The crash problem is gone, BUT it is still not working correctly: now the function is returning me a void link (no link).

    I am sure that the productid I am passing through is correct. The only issue I can see on my declaration is that I am passing a void product name, however in the manual they say that I can do that and that the function will figure out the product name, so I don't think that it really be the cause.

    Any idea?

    PS: In the manual there is a note about ProductLink function that says "NOTE: This function is for backward compatibility with Parser functions only and should not be used in XmlPackage transforms because it outputs invalid XML when using the IncludeATag." Question is: since this is considered a deprecated function, what would be the one to be used in place of?
    Last edited by LPBR; 03-01-2013 at 09:46 AM.

  4. #4
    mmcgeachy is offline Senior Member
    Join Date
    Sep 2008
    Posts
    174

    Default

    Are you sure the product id is right? SFProductId isn't the normal name for the productid column. Since you could be running a custom query it hard to say for certain but it sounds off to me. To check set the debug to true and you can see for certain. The .xml part is mostly where you should look.

    As for the deprecated thing in the documentation I don't really know to be honest. There are a few more overloads options but that shouldn't matter.
    Last edited by mmcgeachy; 03-04-2013 at 06:46 AM.

  5. #5
    cjbarth is offline Senior Member
    Join Date
    Oct 2008
    Posts
    392

    Default

    Quote Originally Posted by LPBR View Post
    PS: In the manual there is a note about ProductLink function that says "NOTE: This function is for backward compatibility with Parser functions only and should not be used in XmlPackage transforms because it outputs invalid XML when using the IncludeATag." Question is: since this is considered a deprecated function, what would be the one to be used in place of?

    From another XML package provided in the source:
    Code:
    <xsl:value-of select="aspdnsf:EntityLink(EntityID, SEName, $EntityName, 0, '')" />
    ML9.3.1.1
    SQL 2012 Express
    VS 2010
    Azure VM