Skip to content

Commit

Permalink
normalize whitepace in iref/@item and iref/@subitem
Browse files Browse the repository at this point in the history
  • Loading branch information
reschke committed Dec 10, 2023
1 parent eadb095 commit ea41ff8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 21 deletions.
12 changes: 11 additions & 1 deletion clean-for-DTD.xslt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
Strip rfc2629.xslt extensions, generating XML input for "official" xml2rfc
Copyright (c) 2006-2022, Julian Reschke ([email protected])
Copyright (c) 2006-2023, Julian Reschke ([email protected])
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -1044,6 +1044,16 @@
</xsl:if>
</xsl:template>

<xsl:template match="iref/@item|iref/@subitem" mode="cleanup">
<xsl:if test=".!=normalize-space(.)">
<xsl:call-template name="debug">
<xsl:with-param name="msg">Stripping non-normalized whitespace ("<xsl:value-of select="."/>") from iref attribute "<xsl:value-of select="local-name()"/>"</xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:attribute name="{local-name()}">
<xsl:value-of select="normalize-space(.)"/>
</xsl:attribute>
</xsl:template>

<!-- issue tracking extensions -->

Expand Down
20 changes: 10 additions & 10 deletions rfc2629.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -1338,11 +1338,11 @@

<xsl:key name="index-item"
match="iref"
use="@item" />
use="normalize-space(@item)" />

<xsl:key name="index-item-subitem"
match="iref"
use="concat(@item,'..',@subitem)" />
use="concat(normalize-space(@item),'..',normalize-space(@subitem))" />

<xsl:key name="index-xref-by-sec"
match="xref[@x:sec]|relref[@section]"
Expand Down Expand Up @@ -9259,8 +9259,8 @@ dd, li, p {
<div class="print2col">
<ul class="ind">
<xsl:for-each select="//iref | //reference[not(starts-with(@anchor,'deleted-'))]">
<xsl:sort select="translate(concat(@item,/rfc/back/displayreference[@target=current()/@anchor]/@to,@anchor),$lcase,$ucase)" />
<xsl:variable name="letter" select="translate(substring(concat(@item,/rfc/back/displayreference[@target=current()/@anchor]/@to,@anchor),1,1),$lcase,$ucase)"/>
<xsl:sort select="translate(concat(normalize-space(@item),/rfc/back/displayreference[@target=current()/@anchor]/@to,@anchor),$lcase,$ucase)" />
<xsl:variable name="letter" select="translate(substring(concat(normalize-space(@item),/rfc/back/displayreference[@target=current()/@anchor]/@to,@anchor),1,1),$lcase,$ucase)"/>

<xsl:variable name="showit" select="$xml2rfc-ext-include-references-in-index='yes' or self::iref"/>
<xsl:if test="$showit and generate-id(.) = generate-id(key('index-first-letter',$letter)[1])">
Expand All @@ -9270,11 +9270,11 @@ dd, li, p {
<xsl:choose>
<xsl:when test="translate($letter,concat($lcase,$ucase,'0123456789'),'')=''">
<a id="{$anchor-pref}index.{$letter}" href="#{$anchor-pref}index.{$letter}">
<b><xsl:value-of select="$letter" /></b>
<b><xsl:value-of select="$letter"/></b>
</a>
</xsl:when>
<xsl:otherwise>
<b><xsl:value-of select="$letter" /></b>
<b><xsl:value-of select="$letter"/></b>
</xsl:otherwise>
</xsl:choose>

Expand Down Expand Up @@ -12220,11 +12220,11 @@ dd, li, p {
<xsl:variable name="gen">
<xsl:text>http://greenbytes.de/tech/webdav/rfcxml.xslt, </xsl:text>
<!-- when RCS keyword substitution in place, add version info -->
<xsl:if test="contains('$Revision: 1.1553 $',':')">
<xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.1553 $', 'Revision: '),'$','')),', ')" />
<xsl:if test="contains('$Revision: 1.1554 $',':')">
<xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.1554 $', 'Revision: '),'$','')),', ')" />
</xsl:if>
<xsl:if test="contains('$Date: 2023/12/10 10:40:26 $',':')">
<xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2023/12/10 10:40:26 $', 'Date: '),'$','')),', ')" />
<xsl:if test="contains('$Date: 2023/12/10 11:48:18 $',':')">
<xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2023/12/10 11:48:18 $', 'Date: '),'$','')),', ')" />
</xsl:if>
<xsl:variable name="product" select="normalize-space(concat(system-property('xsl:product-name'),' ',system-property('xsl:product-version')))"/>
<xsl:if test="$product!=''">
Expand Down
20 changes: 10 additions & 10 deletions rfcxml.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -1338,11 +1338,11 @@

<xsl:key name="index-item"
match="iref"
use="@item" />
use="normalize-space(@item)" />

<xsl:key name="index-item-subitem"
match="iref"
use="concat(@item,'..',@subitem)" />
use="concat(normalize-space(@item),'..',normalize-space(@subitem))" />

<xsl:key name="index-xref-by-sec"
match="xref[@x:sec]|relref[@section]"
Expand Down Expand Up @@ -9259,8 +9259,8 @@ dd, li, p {
<div class="print2col">
<ul class="ind">
<xsl:for-each select="//iref | //reference[not(starts-with(@anchor,'deleted-'))]">
<xsl:sort select="translate(concat(@item,/rfc/back/displayreference[@target=current()/@anchor]/@to,@anchor),$lcase,$ucase)" />
<xsl:variable name="letter" select="translate(substring(concat(@item,/rfc/back/displayreference[@target=current()/@anchor]/@to,@anchor),1,1),$lcase,$ucase)"/>
<xsl:sort select="translate(concat(normalize-space(@item),/rfc/back/displayreference[@target=current()/@anchor]/@to,@anchor),$lcase,$ucase)" />
<xsl:variable name="letter" select="translate(substring(concat(normalize-space(@item),/rfc/back/displayreference[@target=current()/@anchor]/@to,@anchor),1,1),$lcase,$ucase)"/>

<xsl:variable name="showit" select="$xml2rfc-ext-include-references-in-index='yes' or self::iref"/>
<xsl:if test="$showit and generate-id(.) = generate-id(key('index-first-letter',$letter)[1])">
Expand All @@ -9270,11 +9270,11 @@ dd, li, p {
<xsl:choose>
<xsl:when test="translate($letter,concat($lcase,$ucase,'0123456789'),'')=''">
<a id="{$anchor-pref}index.{$letter}" href="#{$anchor-pref}index.{$letter}">
<b><xsl:value-of select="$letter" /></b>
<b><xsl:value-of select="$letter"/></b>
</a>
</xsl:when>
<xsl:otherwise>
<b><xsl:value-of select="$letter" /></b>
<b><xsl:value-of select="$letter"/></b>
</xsl:otherwise>
</xsl:choose>

Expand Down Expand Up @@ -12220,11 +12220,11 @@ dd, li, p {
<xsl:variable name="gen">
<xsl:text>http://greenbytes.de/tech/webdav/rfcxml.xslt, </xsl:text>
<!-- when RCS keyword substitution in place, add version info -->
<xsl:if test="contains('$Revision: 1.1466 $',':')">
<xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.1466 $', 'Revision: '),'$','')),', ')" />
<xsl:if test="contains('$Revision: 1.1467 $',':')">
<xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.1467 $', 'Revision: '),'$','')),', ')" />
</xsl:if>
<xsl:if test="contains('$Date: 2023/12/09 16:19:10 $',':')">
<xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2023/12/09 16:19:10 $', 'Date: '),'$','')),', ')" />
<xsl:if test="contains('$Date: 2023/12/10 11:48:18 $',':')">
<xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2023/12/10 11:48:18 $', 'Date: '),'$','')),', ')" />
</xsl:if>
<xsl:variable name="product" select="normalize-space(concat(system-property('xsl:product-name'),' ',system-property('xsl:product-version')))"/>
<xsl:if test="$product!=''">
Expand Down

0 comments on commit ea41ff8

Please sign in to comment.