Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 04 Dec 2012 18:16:33 +0100
From:      =?ISO-8859-1?Q?Ren=E9_Ladan?= <rene@freebsd.org>
To:        FBSD Doc project <doc@FreeBSD.org>
Subject:   XSLT template for <email>
Message-ID:  <50BE2FF1.9050901@freebsd.org>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------070704080204090306070503
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit

Hi,

as of r40266 of the projects/entities branch one can write
&committer.email; in $LANG/htdocs which then gets expanded as defined in
share/xml/authors.ent, so:

authors.ent:
<!ENTITY a.greenpuppet "Green Puppet">
<!ENTITY a.greenpuppet.email "&a.greenpuppet;
<email>greenpuppet@FreeBSD.org</email>">

administration.xml:
... some story about ET ...
&a.greenpuppet.email;

administration.html:
... some story about ET ...
Green Puppet <email
xmlns="http://www.FreeBSD.org/XML/email">greenpuppet@reeBSD.org</email>;

The xmlns attribute is defined in share/xml/email.dtd and is required to
keep xmllint (which is run for each XML document) happy.

The attached patch for share/xml/xhtml.xsl defines a template to convert
the <email> tag into XHTML but it looks the template is never reached.
The template above it (process.contentwrap) includes an xsl:copy-of
statement which copies the body of the XML document verbatim, leaving
<email> tags as-is.

So how to get the new template to do its job?  Should part of the
process.contentwrap be rewritten?

René

--------------070704080204090306070503
Content-Type: text/plain; charset=UTF-8;
 name="email-xslt.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="email-xslt.diff"

Index: xhtml.xsl
===================================================================
--- xhtml.xsl	(revision 40265)
+++ xhtml.xsl	(working copy)
@@ -159,6 +159,23 @@
     <xsl:copy-of xmlns:xhtml="http://www.w3.org/1999/xhtml" select="xhtml:html/xhtml:body/*" />
   </xsl:template>
 
+  <xsl:template match="email">
+    <xsl:text>&lt;</xsl:text>
+    <xsl:choose>
+      <xsl:when test="@role='nolink'">
+	<xsl:value-of select="email" />
+      </xsl:when> 
+      <xsl:otherwise>
+	<a>
+	  <xsl:attribute name="href">mailto:<xsl:value-of select="email" /></xsl:attribute>
+	  <!-- auto-generated? --> <xsl:attribute name="shape">rect</xsl:attribute>
+	  <xsl:value-of select="email" />
+	</a>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:text>&gt;</xsl:text>
+  </xsl:template>
+
   <xsl:template name="process.footer">
     &copyright;<br/>
     <xsl:if test="$date != ''">

--------------070704080204090306070503--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50BE2FF1.9050901>