Mercurial > hg > ooxml
diff 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 |
line wrap: on
line diff
--- a/n2a.xsl Wed May 31 17:41:18 2017 +0100 +++ b/n2a.xsl Thu Jun 01 17:21:45 2017 +0100 @@ -45,6 +45,22 @@ then $b/text() else e:shouldnt('rnf',concat(local-name($b),' ',string($b)))"/> </xsl:function> + + <xsl:function name="e:bcrnf" as="xs:string"> + <!-- Like crnf, but backpointer --> + <!-- compute CR-normal-form of a singleton reference --> + <xsl:param name="s" as="element(e:s)"/> + <xsl:value-of select="concat(e:bnf(($s/*)[1]),e:bnf(($s/*)[2]))"/> + </xsl:function> + + <xsl:function name="e:bnf" as="xs:string"> + <!-- invert any relative references, neutralise any absolute ones, i.e. convert a pointer into a kind of backpointer --> + <xsl:param name="s" as="element(*)"/><!-- either a(bsolute) or r(elative)--> + <xsl:value-of select="if (local-name($s)='a') + then concat('ª',$s) (: avoid spurious concord :) + else concat('º',-xs:integer($s/@d))"/> + </xsl:function> + <xsl:function name="e:fnf" as="xs:string"> <!-- rebuild a formula from its parts, but using CRNF for all references -->