I am trying to create an xslt macro (GetURLfromContentPicker) that takes the alias of a content picker as a parameter, and returns the URL of that node. My template has:
I have confirmed that my parameter gets passed correctly by outputting:
<xsl:value-of select="$contentPickerAlias"/>
So now I want to make the magic happen: Get the node id that this alias contains, and return the URL for that node. I understand that library.niceUrl() is the way to go, but I can't seem to get it right.
Jeroen: I could not get the xslt-example to work. But the error changed from parsing error to "error reading xslt".
However the inline version worked like a charm!! Thank you so very much!
Mike: Thanks for your tip also! My contentPickerAlias contains the alias of the contentpicker, not the value it is set to (the node id) so I would have to modify this.
URL from Content Picker
Sorry for this noob question ...
I am trying to create an xslt macro (GetURLfromContentPicker) that takes the alias of a content picker as a parameter, and returns the URL of that node. My template has:
I have confirmed that my parameter gets passed correctly by outputting:
So now I want to make the magic happen: Get the node id that this alias contains, and return the URL for that node. I understand that library.niceUrl() is the way to go, but I can't seem to get it right.
Anyone? :-|
I tried to do:
but it returns a parsing error
Are you using Umbraco 4.5 or higher? In that case try this:
<xsl:value-of select="umbraco.library:NiceUrl(./name()=$contentPickerAlias)" />
You could also do this in an Umbraco item without using xslt:
Jeroen
presume you are doing something like...
<xsl:variable name="contentPickerAlias" select="/macro/ContentPickerAlias"/>
and that contentPickerAlias returns a nodeId.
so all you should heve to do is..
Jeroen: I could not get the xslt-example to work. But the error changed from parsing error to "error reading xslt".
However the inline version worked like a charm!! Thank you so very much!
Mike: Thanks for your tip also! My contentPickerAlias contains the alias of the contentpicker, not the value it is set to (the node id) so I would have to modify this.
is working on a reply...