XSLT template for <email>
René Ladan
rene at freebsd.org
Tue Dec 4 21:18:02 UTC 2012
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 04-12-2012 18:37, Hiroki Sato wrote:
> René Ladan <rene at freebsd.org> wrote in
> <50BE2FF1.9050901 at freebsd.org>:
>
> re> Hi, re> re> as of r40266 of the projects/entities branch one
> can write re> &committer.email; in $LANG/htdocs which then gets
> expanded as defined in re> share/xml/authors.ent, so: re> re>
> authors.ent: re> <!ENTITY a.greenpuppet "Green Puppet"> re>
> <!ENTITY a.greenpuppet.email "&a.greenpuppet; re>
> <email>greenpuppet at FreeBSD.org</email>"> re> re>
> administration.xml: re> ... some story about ET ... re>
> &a.greenpuppet.email; re> re> administration.html: re> ... some
> story about ET ... re> Green Puppet <email re>
> xmlns="http://www.FreeBSD.org/XML/email">greenpuppet at reeBSD.org</email>
>
>
re>
> re> The xmlns attribute is defined in share/xml/email.dtd and is
> required to re> keep xmllint (which is run for each XML document)
> happy. re> re> The attached patch for share/xml/xhtml.xsl defines a
> template to convert re> the <email> tag into XHTML but it looks the
> template is never reached. re> The template above it
> (process.contentwrap) includes an xsl:copy-of re> statement which
> copies the body of the XML document verbatim, leaving re> <email>
> tags as-is. re> re> So how to get the new template to do its job?
> Should part of the re> process.contentwrap be rewritten?
>
> | + <xsl:template match="email">
>
> You needed to add namespace for email element if you did not
> define it. This is because the default namespace in
> <xsl:stylesheet> is defined as xmlns="http://www.w3.org/1999/xhtml"
> in xhtml.xsl.
>
Do you mean what is described in the attached new patch, or that all
<email> elements in authors.ent need to have a namespace definition as
attribute (which would make it very cumbersome)?
The generated administration.xml now looks a bit different but the
<email> tags are not converted yet.
René
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (FreeBSD)
Comment: Using GnuPG with undefined - http://www.enigmail.net/
iQIcBAEBAgAGBQJQvmiEAAoJEK27+GEKN4m3LKgP/iEhZ9UhzoY8L+V5cQS5b7wM
USY43VUvi2XXpfBsNa8WSSO3maCdW8s3F2L6B3yWQPreLLGPIAiSsUiQ9+CzYH01
Ojl5CdgQ9WRoVT09KThv4cZkXd8BU+MERtfttyepzv4uIzowVa3SdqbRDPypUWWh
cN1jkjxOSAxPxqZGGwdHd7fn94BcNzYHEf7rlxEsVhV0P6OidvnZun6ZoxViMfGT
trQlWFzc6An8K4X0MmBoxhYrc7efUwNshlXh+nLRnTg91x/l99CZtXql5oCqzLTw
arvxM+vmfYiOqgEm7AcrO+Cs8WWgpDOLNypSOj7RmBtsk3M1zvu4pnmW3irEQuHl
ZQRF4dH6YKHt3hhEdta8H6C5ciia5hq59LXG334Gl1scAvG6I3RBNt82lWSfzqhC
KTheSg2BW1yYFYK+8B2nUQOI2VGpam2yJejajo3tkipmtvlHST+AlpmsbmIfBzvQ
DmB7uEaJ1gOyoGIZqHRingC9keyZmNFBmPSin/In/f6bXE9gqWHONyQyxs5jlzBC
L43X+s9mLBMXUzuFzLKV0bJPNBQw/fXzUMAyAOjDVekBCPYpEvzARxlnldFe4mqL
wbixaAIM+d4vOMf4uOoTd3nCfkwfWGsaEzvZcS88fi589kBrSHIS9FacwF3IRPqZ
yc1oJHLhFF3eXe8wdX/a
=mwrD
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: share/xml/email.dtd
===================================================================
--- share/xml/email.dtd (revision 40265)
+++ share/xml/email.dtd (working copy)
@@ -2,4 +2,5 @@
<!ATTLIST email
role (nolink) #IMPLIED
xmlns CDATA "http://www.FreeBSD.org/XML/email"
+ xmlns:email CDATA "http://www.FreeBSD.org/XML/email"
>
Index: share/xml/xhtml.xsl
===================================================================
--- share/xml/xhtml.xsl (revision 40265)
+++ share/xml/xhtml.xsl (working copy)
@@ -6,10 +6,11 @@
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:cvs="http://www.FreeBSD.org/XML/CVS"
+ xmlns:email="http://www.FreeBSD.org/XML/email"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:str="http://exslt.org/strings"
xmlns="http://www.w3.org/1999/xhtml"
- exclude-result-prefixes="cvs xhtml"
+ exclude-result-prefixes="cvs xhtml email"
extension-element-prefixes="str">
<xsl:variable name="rsslink" select="''"/>
@@ -159,6 +160,23 @@
<xsl:copy-of xmlns:xhtml="http://www.w3.org/1999/xhtml" select="xhtml:html/xhtml:body/*" />
</xsl:template>
+ <xsl:template match="email:email">
+ <xsl:text><</xsl:text>
+ <xsl:choose>
+ <xsl:when test="@role='nolink'">
+ <xsl:value-of select="email:email" />
+ </xsl:when>
+ <xsl:otherwise>
+ <a>
+ <xsl:attribute name="href">mailto:<xsl:value-of select="email:email" /></xsl:attribute>
+ <!-- auto-generated? --> <xsl:attribute name="shape">rect</xsl:attribute>
+ <xsl:value-of select="email:email" />
+ </a>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>></xsl:text>
+ </xsl:template>
+
<xsl:template name="process.footer">
©right;<br/>
<xsl:if test="$date != ''">
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xslt-email-2.diff.sig
Type: application/octet-stream
Size: 543 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-doc/attachments/20121204/19b316f6/attachment.obj>
More information about the freebsd-doc
mailing list