root/branches/binary/server/doc/xml2rfc/rfc2629-refchk.xsl @ 776

Revision 776, 2.5 kB (checked in by astone, 20 months ago)

Rearrange the binary protocol docs and xml2rfc tools.

Line 
1<?xml version="1.0" encoding="utf-8"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3                version="1.0">
4
5  <xsl:output method="xml"/>
6
7  <xsl:template match='/'>
8    <refcheck>
9      <xsl:apply-templates select='//xref' mode='missing'/>
10      <xsl:apply-templates select='//reference' mode='orphans'/>
11      <xsl:apply-templates select='//references[@dwdrfc-type = "norm"]' mode='normcheck'/>
12      <xsl:apply-templates select='//xref[@dwdrfc-type = "norm"]' mode='normrefs'/>
13    </refcheck>
14  </xsl:template>
15 
16  <xsl:template match='xref' mode='missing'>
17    <xsl:param name='refname'>
18      <xsl:value-of select='@target'/>
19    </xsl:param>
20    <xsl:param name='reftgt'>
21      <xsl:value-of select='//*[@anchor = $refname]/@anchor'/>
22    </xsl:param>
23    <xsl:choose>
24      <xsl:when test='$reftgt = $refname'/>
25      <xsl:otherwise>
26        <missing><xsl:value-of select='$refname'/></missing><xsl:text>
27      </xsl:text>
28    </xsl:otherwise>
29  </xsl:choose>
30  </xsl:template>
31 
32  <xsl:template match='xref' mode='normrefs'>
33    <xsl:param name='refname'>
34      <xsl:value-of select='@target'/>
35    </xsl:param>
36    <xsl:param name='reftgt'>
37      <xsl:value-of select='//references[@dwdrfc-type = "norm"]/*[@anchor = $refname]/@anchor'/>
38    </xsl:param>
39    <xsl:choose>
40      <xsl:when test='$reftgt = $refname'/>
41      <xsl:otherwise>
42        <missing-norm><xsl:value-of select='$refname'/></missing-norm><xsl:text>
43      </xsl:text>
44    </xsl:otherwise>
45  </xsl:choose>
46  </xsl:template>
47 
48  <xsl:template match='reference' mode='orphans'>
49    <xsl:param name='refname'>
50      <xsl:value-of select='@anchor'/>
51    </xsl:param>
52    <xsl:param name='reftgt'>
53      <xsl:value-of select='//xref[@target = $refname]/@target'/>
54    </xsl:param>
55    <xsl:if test='$reftgt != $refname'>
56      <orphan><xsl:value-of select='$refname'/></orphan><xsl:text>
57    </xsl:text>
58  </xsl:if>
59</xsl:template>
60
61<xsl:template match='references' mode='normcheck'>
62  <xsl:apply-templates mode='normcheck'/>
63</xsl:template>
64
65<xsl:template match='*' mode='normcheck'>
66  <!-- Need to find at least one normative reference -->
67  <xsl:param name='refname'>
68    <xsl:value-of select='@anchor'/>
69  </xsl:param>
70  <xsl:param name='reftgt'>
71    <xsl:value-of select='//xref[@dwdrfc-type = "norm" and @target = $refname]/@target'/>
72  </xsl:param>
73  <xsl:if test='$refname != $reftgt'>
74    <normchk><xsl:value-of select='$refname'/></normchk><xsl:text>
75</xsl:text>
76  </xsl:if>
77</xsl:template>
78
79<xsl:template match='text()' mode='normcheck'/>
80
81</xsl:stylesheet>
Note: See TracBrowser for help on using the browser.