XSLT query: select nodes from a certain doctype under a certain root node
Hey folks, it's me again :-)
I am trying to implement a method in .NET that allows me to get nodes from a certain type that reside under a certain other node. The method signature is this
I want to create an XPath query that allows me to select anything under "rootNode" that is a node of one of the document types in restrictDocTypes.
The main question here is: how do I get the supplied rootNode in my xPath query? Basically I need the XSLT equivalent of "$rootNode/descendant-or-self::*..... etc". Is it possible to somehow convert the supplied .NET rootNode to a variable in my XSLT query?
XSLT query: select nodes from a certain doctype under a certain root node
Hey folks, it's me again :-)
I am trying to implement a method in .NET that allows me to get nodes from a certain type that reside under a certain other node. The method signature is this
I want to create an XPath query that allows me to select anything under "rootNode" that is a node of one of the document types in restrictDocTypes.
The main question here is: how do I get the supplied rootNode in my xPath query? Basically I need the XSLT equivalent of "$rootNode/descendant-or-self::*..... etc". Is it possible to somehow convert the supplied .NET rootNode to a variable in my XSLT query?
I suppose you could do something like:
string xPathQuery = "/root/descendant::* [@id = '" + rootNode.Id + "']/";
You could also probably do something like rootNode.Children.Where(n => n.nodeTypeAlias == 'whatever')
Also if you haven't already, look into uQuery and their extension methods, there are some that should help you out ie rootNode.GetDescendantNodes
Hey Tom,
This is what I came up with and it works:
"/root/descendant::* [@id = 1100]/descendant::* [@isDoc and @nodeType = 1067 or @nodeType = 1022]"
First the supplied root node is selected and then descendants of the root node with nodeTypes 1067 or 1022.
Thanks.
is working on a reply...