I have found a weird problem when trying to use apply-templates and GetXmlNodeById. When running the code below the xslt cannot be saved, say umbraco. There are no errors in my xslt and the page works perfectly if I save and "ignore errors".
The reason the XSLT editor (in the Umbraco back-office) is showing an error is because the parser doesn't know that "pageId" is numeric (or even holds a value).
If you wrap a condition around the apply-templates, then the XSLT editor will be happier:
apply-templates and GetXmlNodeById
I have found a weird problem when trying to use apply-templates and GetXmlNodeById. When running the code below the xslt cannot be saved, say umbraco. There are no errors in my xslt and the page works perfectly if I save and "ignore errors".
<xsl:apply-templates select="umbraco.library:GetXmlNodeById('pageId')" />
Why is it doing this?
/Rune
Hi Rune,
The reason the XSLT editor (in the Umbraco back-office) is showing an error is because the parser doesn't know that "pageId" is numeric (or even holds a value).
If you wrap a condition around the apply-templates, then the XSLT editor will be happier:
Obviously replace 'pageId' with the correct property/attribute/value.
Like you say, the XSLT is still perfectly valid (and works) ... so its up to you whether you want to keep the XSLT editor happy? ;-)
Cheers, Lee.
Super. That took care of that problem. Thanks man.
/Rune
is working on a reply...