A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Parents node's position in XSL

1. Count parents using <xsl:number>
Number can be extracted:
($n)=$c=~/(\d+)\.\d+\.\d+\.\d+$/;
and adjusted:
$n=((($n/2)-5)+1)

<xsl:number count="." level="multiple" from="/page" format="1"/>

Or with format="a", interpret like j=1, l=2, n=3, p=4, etc.

2. Count parents using position()
Simpler -- but apparently this is a weird way to do it. Probably inefficient too.

<xsl:value-of select="count(parent::*/parent::*/parent::*/preceding-sibling::*) - 3"/>