Subject: [xsl] Find First Descendants That Match Predicate? From: "Eliot Kimber ekimber@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Mon, 24 Dec 2018 20:57:32 -0000 |
Using XPath 3: o;?I have an XML structure where there are elements with titles (e.g., foo/title, bar/title) that may have an arbitrary of untitled wrappers around them, e.g.: <root> <chapter><title>C1</chapter> <wrapper> <wrapper> <section><title>S1</section> </section> </wrapper> <section><title>S2</title> <section><title>S3</title> </section> </section> </wrapper> Given a starting node, e.g., the root node (but could be any node in the hierarchy) I need to find the first titled "child" nodes, so given the chapter node I need to find S1 and S2 but not S3. I need to do this in a single XPath expression (I'm using the expression to get a list of nodes that are then being used elsewhere). I can't figure out how to construct an expression so that it only returns the descendants of the starting node that match the predicate (e.g. *[title]) and that are the first such in a breadth-first evaluation. I feel like there's an obvious solution that I'm just not seeing. Thanks, Eliot -- Eliot Kimber http://contrext.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Data extraction, Mailing Lists Mail d | Thread | Re: [xsl] Find First Descendants Th, Graydon graydon@xxxx |
Re: [xsl] Data extraction, Mailing Lists Mail d | Date | Re: [xsl] Find First Descendants Th, Graydon graydon@xxxx |
Month |