commit:     200818b99d2f874ad9e885861704a53d29f4e619
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Fri Jan  3 19:11:04 2020 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Tue Jan  7 08:53:02 2020 +0000
URL:        https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=200818b9

devbook.xsl: ID attributes should contain only valid characters.

Keep only characters that HTML 4 allows in ID attributes (but exclude
the colon as well). Note that HTML 5 is more sloppy and would permit
characters outside of the ASCII range, but these won't be valid in URI
fragment identifiers (RFC 3986).

Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 devbook.xsl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/devbook.xsl b/devbook.xsl
index 2a5dea2..9d3d5f0 100644
--- a/devbook.xsl
+++ b/devbook.xsl
@@ -280,7 +280,10 @@
     <xsl:param name="data"/>
     <xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz--</xsl:variable>
     <xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ<xsl:text> 
</xsl:text>,</xsl:variable>
-    <xsl:value-of 
select="translate(normalize-space($data),$ucletters,$lcletters)"/>
+    <xsl:variable name="lcdata" select="translate(normalize-space($data), 
$ucletters, $lcletters)"/>
+    <!-- Delete anything but letters, digits, hyphen, dot, underscore -->
+    <xsl:variable 
name="allowed">abcdefghijklmnopqrstuvwxyz0123456789-._</xsl:variable>
+    <xsl:value-of select="translate($lcdata, translate($lcdata, $allowed, ''), 
'')"/>
   </xsl:template>
 
   <xsl:template match="uri">

Reply via email to