Subject: Re: [xsl] List type, probably a sequence problem (XSL 2) From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Thu, 8 Jun 2023 19:50:12 -0000 |
On Thu, Jun 08, 2023 at 07:21:42PM -0000, Trevor Nicholls trevor@xxxxxxxxxxxxxxxxxx scripsit: > Hi Graydon Hi! > Thanks for taking a look. > > Your idea was my starting point too, but the trouble with > ancestor::list[not(descendant::steps)] is that if I'm the context node (a > list) I may have a steps *descendant* (which will thus also be a descendant > of all of my ancestors), but this descendant should not influence my > formatting. Steps only matter if they are my ancestors. I think if you assign the context node to $this, you could ancestor::list[not(descendant::steps[descendant::*[. is $this]])] which isn't dripping with elegance but might do the thing. > So I switched from this approach to trying to manipulate a sequence, but ran > out of ingenuity pretty quickly. $nameList := ancestor::*[self::list or self::steps]/name() $closest as xs:integer := $nameList => index-of('steps') => min() should give you the closest steps (assuming there is one; there needs to be a test for that.) then it's $relevant := subsequence($nameList,1,$closest) => string-length() and do the odd-or-even testing on $relevant, maybe? (Pardon the XQuery syntax!) -- Graydon Saunders | graydonish@xxxxxxxxx ^fs oferiode, pisses swa mfg. -- Deor ("That passed, so may this.")
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] List type, probably a seq, Trevor Nicholls trev | Thread | Re: [xsl] List type, probably a seq, David Carlisle d.p.c |
Re: [xsl] List type, probably a seq, Trevor Nicholls trev | Date | Re: [xsl] List type, probably a seq, David Carlisle d.p.c |
Month |