Mercurial > hg > ooxml
changeset 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 | a783afa2b109 |
children | f90bbd38b8f6 |
files | n2a.xsl notes.txt refs2.xsl |
diffstat | 3 files changed, 25 insertions(+), 4 deletions(-) [+] |
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 -->
--- a/notes.txt Wed May 31 17:41:18 2017 +0100 +++ b/notes.txt Thu Jun 01 17:21:45 2017 +0100 @@ -111,7 +111,10 @@ Should put another step after refs.xsl to compute a map from distinct-values of all targets to all the cells which use them DONE. -Likewise ranges @@ +Now provides inverted rel. ref info so that static input columns can +be identified from their users. + +Likewise ranges -- range endpoints in place, @@ what about the things themselves? That really does mean we should move to elts for each ref or range, since at this point we want to compute vector @@ -223,8 +226,8 @@ #F13A13, # Vivid Reddish Orange #232C16, # Dark Olive Green ------------ -@@ string identify, to say nothing of actual value, is lost -- fix? -@@ row/column/both spans +@@ string identity, to say nothing of actual value, is lost -- fix? +@@ row/column/both spans [what?] ------ enron1k/kenneth_lay__19506 contains this formula:
--- a/refs2.xsl Wed May 31 17:41:18 2017 +0100 +++ b/refs2.xsl Thu Jun 01 17:21:45 2017 +0100 @@ -23,7 +23,9 @@ <xsl:variable name="r" select="."/> <i r="{$r}"> <xsl:for-each select="key('ref',$r,$refs)"> - <r><xsl:value-of select="@r"/></r> + <r b="{string-join(distinct-values(for $s in e:s return + if (translate($s/@r,'$','')=$r) then e:bcrnf($s) else ()), + ',')}"><xsl:value-of select="@r"/></r> </xsl:for-each> <xsl:for-each select="key('rrefTL',$r,$refs)"> <r><<xsl:value-of select="@r"/></r>