Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Home » Tip Bank » XML » XSLT
Language: XSLT
Expertise: Beginner
Jul 10, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Filtering On Node Name


I have an XML document for news items. It has a tag which has 3 child nodes , and , of which there can be multiples with the one tag. For example:


What I want to be able to do is branch to a given template, depending on the name of the node in the order that they displayed, within the tag. I have tried using and , but where I keep getting stuck is in testing for the name of the current node. I could, of course, use a generic tag called, and let it have an attribute called "type" Then I could evaluate the branching the attribute, but, in a way, this defeats the purpose of using XML. What would you suggest?


Just use the call and wildcard characters:

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date