However I'd like to pass the value of my "Menu Items ID" property (alias=menuItemsID) into the GetXMLNodeById function. So the ID is dynamicall fetched.
I've tried 2 ways from a previous forum and a WIKI page but to no avail (I wonder do I need to wait for UMB caching to recognize new property?)
I guess that you have the corMenuItemsID-property (or is it menuItemsID as you mentioned in your first post?) on the current page? If you do could you maybe try this out:
I received the following error below, do I have to create a parameter for this macro first in the Developer Section? Also I'm on 4.5.1 if this matters.
Error occured
System.Xml.Xsl.XslLoadException: The variable or parameter 'currentPage' is either not defined or it is out of scope. An error occurred at C:\inetpub\wwwroot\xslt\634181701810191856_temp.xslt(13,5). at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver) at System.Xml.Xsl.XslCompiledTransform.Load(XmlReader stylesheet, XsltSettings settings, XmlResolver stylesheetResolver) at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)
Hmm...Did you not create this xslt-file through Umbraco? If you didn't could you please insert the following snippet just above the <xsl:template match="/"> :
<xsl:paramname="currentPage"/>
It's a good idea to create your XSLT-files through Umbraco (especially in the beginning when you are still learning about the CMS) because you'll then alway have access to the $currentPage, umbraco.library etc. without doing anything.
Well, if you are grabbing the "Menu Items ID" through the xslt I provided earlier, you don't need the macro parameter called menuID. You can remove that parameter from the macro (if you even created it) and from the line where you insert the macro in the template.
Also make sure your content nodes are republished if you change the propertiy names on your documenttypes. This caused much confusion when my code was right, but didnt get the expected results. It was due to outdated xml cache.
Dynamically Passing a Property Value to an XSLT macro
I have this working perfectly:
However I'd like to pass the value of my "Menu Items ID" property (alias=menuItemsID) into the GetXMLNodeById function. So the ID is dynamicall fetched.
I've tried 2 ways from a previous forum and a WIKI page but to no avail (I wonder do I need to wait for UMB caching to recognize new property?)
I've tried this:
but id didn't work...
I've tried this:
with this
and that didn't work. Not too sure from here.
I guess that you have the corMenuItemsID-property (or is it menuItemsID as you mentioned in your first post?) on the current page? If you do could you maybe try this out:
/Kim A
I received the following error below, do I have to create a parameter for this macro first in the Developer Section? Also I'm on 4.5.1 if this matters.
Hmm...Did you not create this xslt-file through Umbraco? If you didn't could you please insert the following snippet just above the <xsl:template match="/"> :
It's a good idea to create your XSLT-files through Umbraco (especially in the beginning when you are still learning about the CMS) because you'll then alway have access to the $currentPage, umbraco.library etc. without doing anything.
/Kim A
I have that, I didn't create a Parameter for the Macro. Is that the missing link?
Well, if you are grabbing the "Menu Items ID" through the xslt I provided earlier, you don't need the macro parameter called menuID. You can remove that parameter from the macro (if you even created it) and from the line where you insert the macro in the template.
/Kim A
That worked. Thanks a million. May your Karma increase 100 fold.
Good to hear Kevon! Glad I could help :)
/Kim A
Kim,
I was researching a similar issue and your solution helped a bunch. Thanks!
-Wm
Also make sure your content nodes are republished if you change the propertiy names on your documenttypes. This caused much confusion when my code was right, but didnt get the expected results. It was due to outdated xml cache.
I'm glad you can use the answer William. It's just great when "old" answers helps people out several months after they where posted :)
/Kim A
is working on a reply...