Both $thisVideoPage andf $relatedVideoPage return the correct ID, so why cant I dynamically switch out this $video object?? As soon as I output any property of the $video variable (which is supposed to be the video page object), I get an XSLT parsing error.
Have a page where you can select a video page from somewhere else to show, and this stores as an ID. But thereare instances of these pages in each language so that's why I am using GetRelatedNodesAsXml(). What's wrong with this code? Can't see any way to write the links / show the video thumb if I can't use this $video object.
Yes. Same result. Seems to happen to me every time I put logic inside a variable. But I can't wrap the logic around the variable declarations either, so what do I do here? I don't want to have some gigantic logic block that does something completely different based on whether it's a related node or the main node.
Yes. Same result. Seems to happen to me every time I put logic inside a variable. But I can't wrap the logic around the variable declarations either, so what do I do here? I don't want to have some gigantic logic block that does something completely different based on whether it's a related node or the main node.
The last line of Sean's 2nd reply is the key - because as soon as you "open" a variable or param declaration (thus using its contents rather than the select attribute), the result is going to be either a string (like when you were using value-of) or something called a "Result Tree Fragment" (using copy-of or literal XML nodes inside).
Neither of those are able to be used with XPath - but the RTF variable can be converted to a node set by using the msxml:node-set() function.
In this case it's probably possible to actually do the selection in the select attribute, but it can be a little harder to read since it'll use some tricky set logic to make the selection.
Using Related Nodes Method
Hi,
Why am I getting a parsing error from this code?
Both $thisVideoPage andf $relatedVideoPage return the correct ID, so why cant I dynamically switch out this $video object?? As soon as I output any property of the $video variable (which is supposed to be the video page object), I get an XSLT parsing error.
Have a page where you can select a video page from somewhere else to show, and this stores as an ID. But thereare instances of these pages in each language so that's why I am using GetRelatedNodesAsXml(). What's wrong with this code? Can't see any way to write the links / show the video thumb if I can't use this $video object.
Thanks,
Garrett
Have you tried using xsl:copy-of instead of xsl:value-of?
<xsl:copy-ofselect="$thisVideoPage"/>
and
<xsl:copy-ofselect="umbraco.library:GetXmlNodeById($relatedVideoPage/relations/relation/node/@id)"/>
Yes. Same result. Seems to happen to me every time I put logic inside a variable. But I can't wrap the logic around the variable declarations either, so what do I do here? I don't want to have some gigantic logic block that does something completely different based on whether it's a related node or the main node.
//Garrett
Yes. Same result. Seems to happen to me every time I put logic inside a variable. But I can't wrap the logic around the variable declarations either, so what do I do here? I don't want to have some gigantic logic block that does something completely different based on whether it's a related node or the main node.
//Garrett
This is how I typically do it:
you can also use this little trick to see the xml that you have:
Hi Garrett,
The last line of Sean's 2nd reply is the key - because as soon as you "open" a variable or param declaration (thus using its contents rather than the select attribute), the result is going to be either a string (like when you were using value-of) or something called a "Result Tree Fragment" (using copy-of or literal XML nodes inside).
Neither of those are able to be used with XPath - but the RTF variable can be converted to a node set by using the msxml:node-set() function.
In this case it's probably possible to actually do the selection in the select attribute, but it can be a little harder to read since it'll use some tricky set logic to make the selection.
/Chriztian
is working on a reply...