|
Subject: Re: [xsl] List type, probably a sequence problem (XSL 2) From: "Trevor Nicholls trevor@xxxxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Thu, 8 Jun 2023 19:21:36 -0000 |
Hi Graydon
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.
So I switched from this approach to trying to manipulate a sequence, but ran
out of ingenuity pretty quickly.
cheers
T
-----Original Message-----
From: Graydon graydon@xxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Friday, 9 June 2023 06:55
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] List type, probably a sequence problem (XSL 2)
On Thu, Jun 08, 2023 at 06:40:55PM -0000, Trevor Nicholls
trevor@xxxxxxxxxxxxxxxxxx scripsit:
> The rules are that steps should always be numbered. Lists should
> always use the alternate scheme to their nearest ancestor, and a list
> with no ancestor list or step should be numeric.
So if I'm standing on an li --
<xsl:template match="li">
<xsl:choose>
<!-- my parent list is a steps list -->
<xsl:when test="parent::steps">
<xsl:attribute name="list-type" select='decimal'/>
</xsl:when>
<xsl:when test="count(ancestor::list[not(descendant::steps)])
mod 2 eq 0>
<xsl:attribute name="list-type" select='alpha'/>
</xsl:when>
<xsl:when test="count(ancestor::list[not(descendant::steps)])
mod 2 eq 1>
<xsl:attribute name="list-type" select='decimal'/>
</xsl:when>
</xsl:choose>
<!-- other stuff -->
</xsl:template>
(I don't think I've managed to retain the correct style names for the list
types, so this won't be exactly right.)
--
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, Graydon graydon@xxxx | Thread | Re: [xsl] List type, probably a seq, Graydon graydon@xxxx |
| Re: [xsl] List type, probably a seq, Graydon graydon@xxxx | Date | Re: [xsl] List type, probably a seq, Graydon graydon@xxxx |
| Month |