i'm wondering if the following wiki is now out of date? Following it to the letter but not getting the info back from the macro, has the syntax chnaged?
It's not returning a node element for sure. It's rather returning an element with a name corresponding to your document type name, which could be "<Document>" or "<Textpage>" or what you have called the document type. And the title property would simply just be a <title> element. Pleae note that document type element are starting with Uppercase letter and property elements are all lowercase.
Might be a side issue, but me thinks your xml syntax is case sensitive, so if you param's alias is called contenttree, you need to use /macro/contenttree as well to get the info.
Also, easier to show the xml returned from param is using <xmp><xsl:value-of select="/macro/contenttree" /></xmp>
my param Alias is set as "contentTree" but when i insert via a text editior and view the html is reads as "umb_contenttree="1193"", i think i'll opt for the content picker method you mentioned...thanks for the replies..
don't worry 'bout the umb_contenttree stuff in your rte, that's quite normal if you're inserting a macro into a rte, it won't have any effect on the workings of the macro. Agreed, it's a bit cumbersome, but once you know it, you do no longer worry about that syntax.
Even tho you'd be using a content picker, syntax will remain the same in the rte, so don't worry about that.
Getting the content tree nodeName
i'm wondering if the following wiki is now out of date? Following it to the letter but not getting the info back from the macro, has the syntax chnaged?
http://our.umbraco.org/wiki/reference/templates/umbracomacro-element/macro-parameters
here's my code...
Hi Stephen
Yes the wiki entry about this should be updated with examples using the new XML schema, which was introduced with Umbraco 4.5.
You don't get anything back since you're trying to fetch a node element and you're also trying to fetch an @alias attribute with the name "title".
try doing this to see what XML the contentTree returns.
<textarea>
<xsl:copy-of select="/macro/contentTree"/>
</textarea>
It's not returning a node element for sure. It's rather returning an element with a name corresponding to your document type name, which could be "<Document>" or "<Textpage>" or what you have called the document type. And the title property would simply just be a <title> element. Pleae note that document type element are starting with Uppercase letter and property elements are all lowercase.
I hope this helps.
/Jan
Hi Jan thanks for the reply...I have tried just using "/macro/contentTree" and it is returning my macro copy?
<p><?UMBRACO_MACRO contenttree="1193" macroAlias="ListServicesByRoom" /></p> <p> </p> <br /> <br /> 0 Services
weird...
all i'm really after is the nodeName...
<xsl:value-of select="/macro/contentTree/node/nodeName"/>
is there a wiki explaining the converison from old to new schema?
S
Stephen,
Might be a side issue, but me thinks your xml syntax is case sensitive, so if you param's alias is called contenttree, you need to use /macro/contenttree as well to get the info.
Also, easier to show the xml returned from param is using <xmp><xsl:value-of select="/macro/contenttree" /></xmp>
Cheers,
/Dirk
Stephen,
if only you need a nodeName of a single node, why do you need the contentTree, can't you use content picker, which will only pass an id to your macro?
After that, use <xsl:value-of select="umbraco.library:GetXmlNodeById($id)/nodeName" />
Cheers,
/Dirk
my param Alias is set as "contentTree" but when i insert via a text editior and view the html is reads as "umb_contenttree="1193"", i think i'll opt for the content picker method you mentioned...thanks for the replies..
S
Stephen,
don't worry 'bout the umb_contenttree stuff in your rte, that's quite normal if you're inserting a macro into a rte, it won't have any effect on the workings of the macro. Agreed, it's a bit cumbersome, but once you know it, you do no longer worry about that syntax.
Even tho you'd be using a content picker, syntax will remain the same in the rte, so don't worry about that.
Hope you get it working
Cheers,
/Dirk
ok i now have this xslt...but still can get the nodeName...can get the id using <xsl:value-of select="$id" /> but no name?
*Blush*... should be @nodeName instead of nodeName as this field is an attribute to your node, not a child node... (http://our.umbraco.org/wiki/reference/xslt/45-xml-schema)
Cheers,
/Dirk
Dirk many thanks for your help, out of curiosity does the @nodeName get passed as a string at this point?
<xsl:if test="contains(rooms, $roomName)">
If i have created a parameter like this <xsl:param name="roomName" select="umbraco.library:GetXmlNodeById($id)/@nodeName"/>
I do think so, wouldn't know why not, anyway, if you're unsure, add string($roomName) to explicitely convert it to a string.
Cheers,
/Dirk
is working on a reply...