I'm not sure what you are trying to do is possible. What you have created with $buildQuery is a string not a piece of executable XSLT. In languages like TSQL you would say:
exec $buildQuery
to execute a string as TSQL.
I'm not sure if there is a similar function for XSLT
However, as an alternative would it be possible to add a true/false property to all your document types and then only include the nodes you want. To be sure the property is set correctly you could interrupt the publish event and set the value to true for certain node types...?
I realized I can pass an XPath Query to GetXmlNodeByXPath that creates the XPathNavigator for me and I should be able to iterator through that but its weird that the $buildQuery with the foreach loop in it doesn't get the proper filter.
This filter is for an existing large website and it's something I will be using on other Umbraco sites as well so I'd like to stay away from creating custom properties to deal with this and I've added the exception nodes in the config file.
Addings multiple conditions in for-each loop
I had a for-each loop that skipped a few nodeTypeAlias :
[code]
..code...
[/code]
Although this worked, the node exceptions had to be customised so I've done this:
[code]
...code...
[/code]
But the results isn't filtering the @nodeTypeAlias exceptions I've included in $buildQuery.
I'm probably missing something in here.
I've changed the buildQuery variable to this
[code]
[/code]
and the for-each loop looks like this now:
[code]
[/code]
I'm getting all the nodes though and it isn't filtering the exceptions I've given it. If I manually the exceptions like this:
[code][/code]
The results returned filtered. It would be great if someone knew what was going wrong here.
I'm not sure what you are trying to do is possible. What you have created with $buildQuery is a string not a piece of executable XSLT. In languages like TSQL you would say:
exec $buildQuery
to execute a string as TSQL.
I'm not sure if there is a similar function for XSLT
However, as an alternative would it be possible to add a true/false property to all your document types and then only include the nodes you want. To be sure the property is set correctly you could interrupt the publish event and set the value to true for certain node types...?
Hi Spider,
I realized I can pass an XPath Query to GetXmlNodeByXPath that creates the XPathNavigator for me and I should be able to iterator through that but its weird that the $buildQuery with the foreach loop in it doesn't get the proper filter.
This filter is for an existing large website and it's something I will be using on other Umbraco sites as well so I'd like to stay away from creating custom properties to deal with this and I've added the exception nodes in the config file.
I knew I missed something! Turns out that in my
[code]
[/code]
the value-of has a space in it so instead of looking for @nodeTypeAlias = 'Homepage' it's looking for @nodeTypeAlias = ' Homepage'.
is working on a reply...