Copied to clipboard

Flag this post as spam?

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


  • Biagio Paruolo 1618 posts 1910 karma points c-trib
    May 19, 2009 @ 14:42
    Biagio Paruolo
    0

    PickUPNode : returning URL and NodeName

    Hi,

    I wrote an XSLT macro:

    [code]
    ]>

    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"
    exclude-result-prefixes="msxml umbraco.library">









    [/code]

    for reading bodyText and for having URL and NodeName.
    All is ok, but
    [code] [/code]
    give me empty string. Why?

    Second:
    Why Had I as result from [code]{umbraco.library:NiceUrl($currentPage/data[@alias='sourceNode'])}[/code]

    http://www.atrigna-tour-n-service.it/news/ponte-2-giugno-ventaglio-calabria.aspx?umbNl=1805 and NOT http://www.atrigna-tour-n-service.it/news/ponte-2-giugno-ventaglio-calabria.aspx

    Why Umbraco append ID node?

    Thanks

  • Duke Maximus 23 posts 20 karma points
    May 22, 2009 @ 02:55
    Duke Maximus
    0

    I know that if you don't pass a valid ID into umbraco.library:GetXmlNodeById(), it will just return the content of your entire text stored in the XML structure.

    You'd want to test the output of $DataPage without the /@nodeName.

    [code][/code]

    I don't really know why your NiceUrl returns the result with a queryString though. I thought the NiceURL method builds your url and adds the ".aspx" to the end.

  • Biagio Paruolo 1618 posts 1910 karma points c-trib
    May 22, 2009 @ 12:38
    Biagio Paruolo
    0

    NiceUrl return link, but add ?umbNl=1805...why???

  • Duke Maximus 23 posts 20 karma points
    May 26, 2009 @ 00:10
    Duke Maximus
    0

    I haven't had that problem before. Sorry mate.

  • Biagio Paruolo 1618 posts 1910 karma points c-trib
    Jun 24, 2009 @ 21:43
    Biagio Paruolo
    0

    Ah... MayBe AGV Antivirus Plugin that control link ...

  • Jesper Hauge 298 posts 487 karma points c-trib
    Jun 24, 2009 @ 23:51
    Jesper Hauge
    0

    Actually I think you have another problem:

    Your code for creating the DataPage variable is missing a context when you try to get an id from the /data subnode.

    Working with xslt in Umbraco is a bit unusual in that there is no default context, so in the following code:

    The /data[@alias='sourceNode'] will not return anything since there is no context for the /data part. In other words the xslt parser have no idea what /data node to look for since you haven't specified the parent node for /data.

    The only way to "jump into" a xslt context in umbraco xslt is through the $currentPage parameter, which will place you on a node in the middle of the content xml for the umbraco front end.

    If your id is stored in a property called sourcenode on the current page where the xslt is used you can get to the data with this code.

    Notice that in this example I've created the variable after the currentPage param, since this needs to be declared before you access it in the variable declaration.

    Regards
    .Hauge

  • Jesper Hauge 298 posts 487 karma points c-trib
    Jun 24, 2009 @ 23:52
    Jesper Hauge
    0

    Argh - this forum editor can't be trusted ATM :( I hope the powers that be will fix it real soon.

    .Hauge

  • Jesper Hauge 298 posts 487 karma points c-trib
    Jun 24, 2009 @ 23:57
    Jesper Hauge
    0

    Argh this editor is very brittle.

    In short: Replace this code 

    <xsl:variable name="DataPage" select="umbraco.library:GetXmlNodeById(/data[@alias='sourceNode'])" />

    With this

    <xsl:param name="currentPage" />
    <xsl:variable name="DataPage" select="umbraco.library:GetXmlNodeById($currentPage/data[@alias='sourceNode'])" />

    To get DataPage to contain the node referenced by the id stored in the sourceNode property of the current page.

    Read around the text with weird tags above to get a longer explanation.

    .Hauge

Please Sign in or register to post replies

Write your reply to:

Draft