comparison n2a.xsl @ 58:adeb9575b273

add inverted rel pointers back to referencing from referenced
author Henry S. Thompson <ht@markup.co.uk>
date Thu, 01 Jun 2017 17:21:45 +0100
parents 9bb415e0adc9
children
comparison
equal deleted inserted replaced
57:a783afa2b109 58:adeb9575b273
43 e:crnf($r)) 43 e:crnf($r))
44 else if (local-name($b)='v') 44 else if (local-name($b)='v')
45 then $b/text() 45 then $b/text()
46 else e:shouldnt('rnf',concat(local-name($b),' ',string($b)))"/> 46 else e:shouldnt('rnf',concat(local-name($b),' ',string($b)))"/>
47 </xsl:function> 47 </xsl:function>
48
49 <xsl:function name="e:bcrnf" as="xs:string">
50 <!-- Like crnf, but backpointer -->
51 <!-- compute CR-normal-form of a singleton reference -->
52 <xsl:param name="s" as="element(e:s)"/>
53 <xsl:value-of select="concat(e:bnf(($s/*)[1]),e:bnf(($s/*)[2]))"/>
54 </xsl:function>
55
56 <xsl:function name="e:bnf" as="xs:string">
57 <!-- invert any relative references, neutralise any absolute ones, i.e. convert a pointer into a kind of backpointer -->
58 <xsl:param name="s" as="element(*)"/><!-- either a(bsolute) or r(elative)-->
59 <xsl:value-of select="if (local-name($s)='a')
60 then concat('&#xAA;',$s) (: avoid spurious concord :)
61 else concat('&#xBA;',-xs:integer($s/@d))"/>
62 </xsl:function>
63
48 64
49 <xsl:function name="e:fnf" as="xs:string"> 65 <xsl:function name="e:fnf" as="xs:string">
50 <!-- rebuild a formula from its parts, but using CRNF for all references --> 66 <!-- rebuild a formula from its parts, but using CRNF for all references -->
51 <xsl:param name="bits" as="element(*)*"/> 67 <xsl:param name="bits" as="element(*)*"/>
52 <xsl:value-of select="string-join( 68 <xsl:value-of select="string-join(