comparison refs.xsl @ 24:87e0d620deea

switch to elements from attributes and default namespace
author Henry S. Thompson <ht@markup.co.uk>
date Thu, 06 Apr 2017 17:24:30 +0100
parents bfa38afaea63
children a5125a2e77ea
comparison
equal deleted inserted replaced
23:bfa38afaea63 24:87e0d620deea
8 <refs><xsl:apply-templates select="//s:c"/></refs> 8 <refs><xsl:apply-templates select="//s:c"/></refs>
9 </xsl:template> 9 </xsl:template>
10 10
11 <xsl:template match="s:c[s:f]"> 11 <xsl:template match="s:c[s:f]">
12 <xsl:variable name="tokens" select="analyze-string(s:f/.,$pat)/xf:match/xf:group"/> 12 <xsl:variable name="tokens" select="analyze-string(s:f/.,$pat)/xf:match/xf:group"/>
13 <xsl:if test="@r='B4'"><xsl:message><xsl:value-of select="$tokens/@nr"/></xsl:message> 13 <xsl:if test="@r='xxx'"><xsl:message><xsl:value-of select="$tokens/@nr"/></xsl:message>
14 <xsl:message><xsl:value-of select="$tokens/."/></xsl:message> 14 <xsl:message><xsl:value-of select="$tokens/."/></xsl:message>
15 </xsl:if> 15 </xsl:if>
16 <xsl:if test="$tokens[@nr=(7,8,9)]"> 16 <xsl:if test="$tokens[@nr=(7,8,9)]">
17 <xsl:variable name="n" select="count($tokens)"/> 17 <xsl:variable name="n" select="count($tokens)"/>
18 <xsl:variable name="singles" select="for $i in (1 to $n) 18 <xsl:variable name="singles" select="for $i in (1 to $n)
39 $tokens[$i + 3][@nr=10 and .=':']) 39 $tokens[$i + 3][@nr=10 and .=':'])
40 then concat($bit,':',translate($tokens[$i + 4],'$','')) 40 then concat($bit,':',translate($tokens[$i + 4],'$',''))
41 else $bit 41 else $bit
42 else ()"/> 42 else ()"/>
43 <ref c="{@r}"> 43 <ref c="{@r}">
44 <!-- Assumes that space doesn't occur in variable names 44 <xsl:for-each select="$singles">
45 Might occur in external names (who knows!) but I'm assuming we're 45 <s><xsl:value-of select="."/></s>
46 never going to split the value of @er back out... --> 46 </xsl:for-each>
47 <xsl:if test="count($singles)>0"><xsl:attribute name="r"><xsl:value-of select="distinct-values($singles)"/></xsl:attribute></xsl:if> 47 <xsl:for-each select="$ranges">
48 <xsl:if test="count($ranges)>0"><xsl:attribute name="rr"><xsl:value-of select="distinct-values($ranges)"/></xsl:attribute></xsl:if> 48 <r><xsl:value-of select="."/></r>
49 <xsl:if test="count($externals)>0"><xsl:attribute name="er"><xsl:value-of select="distinct-values($externals)"/></xsl:attribute></xsl:if> 49 </xsl:for-each>
50 <xsl:for-each select="$externals">
51 <e><xsl:value-of select="."/></e>
52 </xsl:for-each>
50 </ref></xsl:if> 53 </ref></xsl:if>
51 </xsl:template> 54 </xsl:template>
52 55
53 <xsl:template match="s:c"/> 56 <xsl:template match="s:c"/>
54 </xsl:stylesheet> 57 </xsl:stylesheet>