Guest cjbottaro Posted June 16, 2006 Share Posted June 16, 2006 Hi,I have some recursive xml: <urn> <div> <div> <urn></urn> A <urn> B <urn></urn> C </urn> </div> </div></urn> I'm "at" the first urn node. Now I want to apply a template to all *first level* <urn> tags under current(). I don't know how to say this very well. I want A and B from the above code, but not C. I guess technically, I want all the <urn> tags who's FIRST <urn> ancestor is current().The problem is that I don't know how many divs there will be, so I can't say: select='./*/*/urn' If I say: select='.//urn' then I get ALL the <urn> tags below current(), so that's no good either.Thanks for the help. Link to comment Share on other sites More sharing options...
boen_robot Posted June 17, 2006 Share Posted June 17, 2006 Hi,I have some recursive xml:<urn> <div> <div> <urn></urn> A <urn> B <urn></urn> C </urn> </div> </div></urn> I'm "at" the first urn node. Now I want to apply a template to all *first level* <urn> tags under current(). I don't know how to say this very well. I want A and B from the above code, but not C. I guess technically, I want all the <urn> tags who's FIRST <urn> ancestor is current().The problem is that I don't know how many divs there will be, so I can't say: select='./*/*/urn' If I say: select='.//urn' then I get ALL the <urn> tags below current(), so that's no good either.Thanks for the help. Hmm.... interesting issue. How about something like that:select='.//urn/*[not(local-name(current())='urn']' I'm not completely aware of the not() function, but I think it contains a boolean value which is true if the argument is false and vise versa. I haven't tested this, but I think it might do the trick. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now