Mercurial > hg > Aquinas
view summa/bilingual/bi.xsl @ 122:389b0c620224
more debugging output
| author | ht |
|---|---|
| date | Sat, 30 Oct 2021 17:52:36 +0000 |
| parents | e45e864fda83 |
| children | b0bcf3d6b13f |
line wrap: on
line source
<?xml version='1.0'?> <!DOCTYPE xsl:stylesheet SYSTEM "../../../../lib/xml/xsl.dtd" > <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"> <xsl:param name="rawpart"/> <xsl:variable name="part" select="concat(substring-before($rawpart,'.'),'_',substring-after($rawpart,'.'),'.html')"/> <xsl:variable name="index" select="document('../english/index.xml',/)/*"/> <xsl:key name="iq" match="file" use="substring-before(@name,'_')"/> <xsl:template match="x:a[starts-with(@href,'summa.')]"> <xsl:variable name="tw" select="substring-before(substring-after(@href,'summa.'),'.')"/> <xsl:variable name="tp" select="substring-before($tw,'_')"/> <xsl:variable name="ta" select="substring-after($tw,'_A')"/> <xsl:variable name="tq" select="number(substring-after(if ($ta='') then $tw else substring-before($tw,'_A'),'_Q'))"/> <xsl:variable name="ff" select="key('iq',$tp,$index)"/> <xsl:variable name="f" select="$ff[number(@first) le $tq][number(@last) ge $tq]/@name"/> <xsl:message>ref: <xsl:value-of select="$tw"/><xsl:text> </xsl:text><xsl:value-of select="$f"/></xsl:message> <xsl:message>ref: |<xsl:value-of select="$tp"/>|<xsl:value-of select="$tw"/>|<xsl:value-of select="$ta"/>|<xsl:value-of select="$tq"/>|</xsl:message> <xsl:copy> <xsl:attribute name="href"><xsl:value-of select="concat(if ($part=$f) then '' else (if ($f) then $f else 'unknown.html'),'#',$tw)"/></xsl:attribute> <xsl:apply-templates select="@*[not(local-name()='href')]|node()"/> </xsl:copy> </xsl:template> <xsl:template match="x:h3"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:text>Q. </xsl:text><xsl:value-of select="substring-after(../@id,'FS_Q')"/><xsl:text>. </xsl:text> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="x:h4"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:text>Q. </xsl:text><xsl:value-of select="substring-after(../../@id,'FS_Q')"/><xsl:text>. A. </xsl:text> <xsl:value-of select="substring-after(../@id,'_A')"/> <xsl:text>. </xsl:text> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="x:div[@class='bilingual']"> <xsl:copy> <xsl:apply-templates select="@*"/> <div class="eng"><xsl:apply-templates select="*[1]"/></div> <div class="lat"><xsl:apply-templates select="*[2]"/></div> </xsl:copy> </xsl:template> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> </xsl:stylesheet>
