XSLT template for <email>

René Ladan rene at freebsd.org
Tue Dec 4 17:16:39 UTC 2012


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 at 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 at 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é
-------------- next part --------------
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><</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>></xsl:text>
+  </xsl:template>
+
   <xsl:template name="process.footer">
     ©right;<br/>
     <xsl:if test="$date != ''">


More information about the freebsd-doc mailing list