Probably pretty simple, but I have a doctype that has a propertie called ShowInFooter with a type of True/False. I'm trying to create a macro that would find any documents with this propertie set to true and display them in a list. I'm not getting any errors in my XSLT but its just not returning any documents when I know there is at least 1 with it set to true
System.Xml.Xsl.XslLoadException: Unexpected token '[' in the expression.
@Sebastiaan - I added yours and it saved but still returns nothing? I have triple checked and the property is called 'ShowInFooter' and I have one document ticked as 'Yes' in the UI so I can't understand why it won't show!
Just checking my select does go all the way to the root and then back down? So it does check all documents?
Struggling With Syntax
Probably pretty simple, but I have a doctype that has a propertie called ShowInFooter with a type of True/False. I'm trying to create a macro that would find any documents with this propertie set to true and display them in a list. I'm not getting any errors in my XSLT but its just not returning any documents when I know there is at least 1 with it set to true
Any help very appreciated as to where I am going wrong
Try this:
OK the first thing is to change your xsl:if $currentPage refers to the currentpage you are on and not the current item in the for-each loop.
So change
to
or which should do the same thing
Thanks chaps, help very appreciated
@Warren - I tried both but get this error?
@Sebastiaan - I added yours and it saved but still returns nothing? I have triple checked and the property is called 'ShowInFooter' and I have one document ticked as 'Yes' in the UI so I can't understand why it won't show!
Just checking my select does go all the way to the root and then back down? So it does check all documents?
<xsl:if test="$currentPage/node[string(data[@alias='ShowInFooter']) = '1']">
Check in data/umbraco.config if the data is saved as expected.
You can also add this xpath condition to the xsl:foreach for better performance.
Ron
Ah yes, I forgot you were already in a loop, so this should work a bit better:
Lee,
Remove the surrounding '[' and ']' from the condition in warren's 2nd example.
-Chris
Sorry as Chris mentions it should be like this.
Oops sorry didnt read properly. Chris had already given you the example. Im getting tired time to sign off for today !
Man I thought this would be so easy! I really trying to stick with XSLT but I could do this with a lines of code in ASP.NET!! :(
Anyway... Still not working :(
@Ron -Tried yours and its not returning anything
And checked config and the propertie is there (<data alias="ShowInFooter">1</data>)
@Seb - Thanks again, but still not returning anything? Wondering if its my select statement thats wrong?
HA HAAAAAAAA
I did it, I did it, I did it... Yes I'm quite pleased with myself - I was right, changed my select slighty and now it works
Really appreciate everyones help, many thanks
Glad you got there in the end Lee.
XSLT & XPath does have a learning curve but I think it is worth sticking to, at least until 4.1 when you can use Aaron's Linq2Umbraco instead.
is working on a reply...