1 <?xml version="1.0" encoding="utf-8"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5 <xsl:output method="xml"/>
7 <xsl:template match='/'>
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'/>
16 <xsl:template match='xref' mode='missing'>
17 <xsl:param name='refname'>
18 <xsl:value-of select='@target'/>
20 <xsl:param name='reftgt'>
21 <xsl:value-of select='//*[@anchor = $refname]/@anchor'/>
24 <xsl:when test='$reftgt = $refname'/>
26 <missing><xsl:value-of select='$refname'/></missing><xsl:text>
32 <xsl:template match='xref' mode='normrefs'>
33 <xsl:param name='refname'>
34 <xsl:value-of select='@target'/>
36 <xsl:param name='reftgt'>
37 <xsl:value-of select='//references[@dwdrfc-type = "norm"]/*[@anchor = $refname]/@anchor'/>
40 <xsl:when test='$reftgt = $refname'/>
42 <missing-norm><xsl:value-of select='$refname'/></missing-norm><xsl:text>
48 <xsl:template match='reference' mode='orphans'>
49 <xsl:param name='refname'>
50 <xsl:value-of select='@anchor'/>
52 <xsl:param name='reftgt'>
53 <xsl:value-of select='//xref[@target = $refname]/@target'/>
55 <xsl:if test='$reftgt != $refname'>
56 <orphan><xsl:value-of select='$refname'/></orphan><xsl:text>
61 <xsl:template match='references' mode='normcheck'>
62 <xsl:apply-templates mode='normcheck'/>
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'/>
70 <xsl:param name='reftgt'>
71 <xsl:value-of select='//xref[@dwdrfc-type = "norm" and @target = $refname]/@target'/>
73 <xsl:if test='$refname != $reftgt'>
74 <normchk><xsl:value-of select='$refname'/></normchk><xsl:text>
79 <xsl:template match='text()' mode='normcheck'/>