source: documentation/stable/manuals/processing/crossref-pdf.xsl@ 20741

Last change on this file since 20741 was 13861, checked in by lh92, 17 years ago

updated XSLs

  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"
4 xmlns:java="http://xml.apache.org/xalan/java" xmlns:util="ExternalRef" extension-element-prefixes="util">
5
6 <xsl:template match="CrossRef">
7 <xsl:variable name="ref" select="@ref"/>
8 <xsl:if test="@external">
9 <xsl:variable name="external" select="@external"/>
10 <xsl:value-of select="util:getRef($external, @lang, @target, $ref)"/>
11 </xsl:if>
12
13 <fo:basic-link color="blue" internal-destination="{@target}_{@ref}">
14 <xsl:choose>
15 <xsl:when test="@target='Figure'"><xsl:apply-templates select="//Figure[@id=$ref]" mode="ref"/></xsl:when>
16 <xsl:when test="@target='Table'"><xsl:apply-templates select="//Table[@id=$ref]" mode="ref"/></xsl:when>
17 <xsl:when test="@target='Chapter'"><xsl:apply-templates select="//Chapter[@id=$ref]" mode="ref"/></xsl:when>
18 <xsl:when test="@target='Section'"><xsl:apply-templates select="//Section[@id=$ref]" mode="ref"/></xsl:when>
19 <xsl:when test="@target='Subsection'"><xsl:apply-templates select="//Subsection[@id=$ref]" mode="ref"/></xsl:when>
20 </xsl:choose>
21 </fo:basic-link>
22 </xsl:template>
23
24 <!--<xsl:template match="FootnoteList">
25 <xsl:for-each select="Footnote">
26 <a name="fn{@id}"/><a href="#fnref{@id}">[<xsl:value-of select="@id"/>]</a>
27 <xsl:apply-templates/>
28 <br/>
29 </xsl:for-each>
30 </xsl:template>
31 <xsl:template match="FootnoteRef"><a name="fnref{@id}"/><a href="#fn{@id}">[<xsl:value-of select="@id"/>]</a></xsl:template>-->
32
33 <xsl:template match="Figure" mode="ref">
34 <xsl:variable name="temp_total_figs"><xsl:number count="Figure" level="any"/></xsl:variable>
35 <xsl:variable name="temp_num_of_sub_figs">
36 <xsl:number count="Figure[Title/SubTitle and substring(translate(@id, '_0123456789', '99999999999'), string-length(@id)-1, string-length(@id))='99']" level="any"/>
37 </xsl:variable>
38 <xsl:variable name="no"><xsl:value-of select="$temp_total_figs - $temp_num_of_sub_figs"/></xsl:variable>
39 <xsl:variable name="subtitle">
40 <xsl:if test="Title/SubTitle"><xsl:value-of select="substring-before(substring-after(Title/SubTitle, '('), ')')"/></xsl:if>
41 </xsl:variable>
42 <xsl:value-of select="concat($no, $subtitle)"/>
43 </xsl:template>
44
45 <xsl:template match="Table" mode="ref"><xsl:number level="any" count="Table[not(@class='hidden')]"/></xsl:template>
46
47 <xsl:template match="Chapter" mode="ref"><xsl:number level="any"/></xsl:template>
48
49 <xsl:template match="Section" mode="ref"><xsl:number count="//Chapter|//Chapter//Section" format="1.1" level="multiple"/></xsl:template>
50
51 <xsl:template match="Subsection" mode="ref"><xsl:number level="multiple" format="1.1.1" count="//Chapter|//Chapter//Section|//Chapter//Section//Subsection"/></xsl:template>
52 </xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.