comparison summa/bilingual/bi.xsl @ 72:3dd981256764

fix summa links
author ht
date Sun, 03 Jan 2010 23:43:20 +0000
parents 52063d0f8985
children e45e864fda83
comparison
equal deleted inserted replaced
71:d8c190e4b9ef 72:3dd981256764
1 <?xml version='1.0'?> 1 <?xml version='1.0'?>
2 <!DOCTYPE xsl:stylesheet SYSTEM "../../../../lib/xml/xsl.dtd" > 2 <!DOCTYPE xsl:stylesheet SYSTEM "../../../../lib/xml/xsl.dtd" >
3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:x="http://www.w3.org/1999/xhtml"> 3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:x="http://www.w3.org/1999/xhtml">
4 <xsl:param name="rawpart"/>
5 <xsl:variable name="part" select="concat(substring-before($rawpart,'.'),'_',substring-after($rawpart,'.'),'.html')"/>
6 <xsl:variable name="index" select="document('../english/index.xml',/)/*"/>
7 <xsl:key name="iq" match="file" use="substring-before(@name,'_')"/>
4 8
5 <xsl:template match="x:a[@href and not(text())]"/> 9 <xsl:template match="x:a[starts-with(@href,'summa.')]">
10 <xsl:variable name="tw" select="substring-before(substring-after(@href,'summa.'),'.')"/>
11 <xsl:variable name="tp" select="substring-before($tw,'_')"/>
12 <xsl:variable name="ta" select="substring-after($tw,'_A')"/>
13 <xsl:variable name="tq" select="number(substring-after(if ($ta='') then $tw else substring-before($tw,'_A'),'_Q'))"/>
14 <xsl:variable name="ff" select="key('iq',$tp,$index)"/>
15 <xsl:variable name="f" select="$ff[number(@first) le $tq][number(@last) ge $tq]/@name"/>
16 <xsl:message>ref: <xsl:value-of select="$tw"/><xsl:text> </xsl:text><xsl:value-of select="$f"/></xsl:message>
17 <xsl:copy>
18 <xsl:attribute name="href"><xsl:value-of select="concat(if ($part=$f) then '' else (if ($f) then $f else 'unknown.html'),'#',$tw)"/></xsl:attribute>
19 <xsl:apply-templates select="@*[not(local-name()='href')]|node()"/>
20 </xsl:copy>
21 </xsl:template>
6 22
7 <xsl:template match="x:h3"> 23 <xsl:template match="x:h3">
8 <xsl:copy> 24 <xsl:copy>
9 <xsl:apply-templates select="@*"/> 25 <xsl:apply-templates select="@*"/>
10 <xsl:text>Q. </xsl:text><xsl:value-of select="substring-after(../@id,'FP_Q')"/><xsl:text>. </xsl:text> 26 <xsl:text>Q. </xsl:text><xsl:value-of select="substring-after(../@id,'FP_Q')"/><xsl:text>. </xsl:text>