[jdev] XEP XSL

Jonathan Dickinson jonathanD at k2.com
Fri May 23 06:09:43 CDT 2008


Hi All,

I appropriated the XEP XSL for use in one of the projects I am working on. I found one thing, the <spec> element could really become useful. For example:

See <spec>0001</spec> on how to write XEP documents.

Here are the changes I made:

<xsl:template match='spec' mode='list'>
    <xsl:param name='speccount' select='""'/>
    <xsl:variable name='specpos' select='position()'/>
    <xsl:choose>
      <xsl:when test='$specpos &lt; $speccount'>
        <a>
          <xsl:attribute name='href'>
            <xsl:text>http://www.xmpp.org/extensions/xep-</xsl:text>
            <xsl:value-of select='.' />
            <xsl:text>.html</xsl:text>
          </xsl:attribute>
          XEP-<xsl:value-of select='.'/>
        </a>
        <xsl:text>, </xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <a>
          <xsl:attribute name='href'>
            <xsl:text>http://www.xmpp.org/extensions/xep-</xsl:text>
            <xsl:value-of select='.' />
            <xsl:text>.html</xsl:text>
          </xsl:attribute>
          XEP-<xsl:value-of select='.'/>
        </a>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

---------------

<xsl:choose>
            <xsl:when test='$dependencies.count &gt; 0'>
              <xsl:text>Dependencies: </xsl:text>
              <xsl:apply-templates select='/xep/header/dependencies/spec' mode='list'>
                <xsl:with-param name='speccount' select='$dependencies.count'/>
              </xsl:apply-templates>

<!-- Apply to others in header -->

---------------

  <xsl:template match='spec'>
    <a>
      <xsl:attribute name='href'>
        <xsl:text> http://www.xmpp.org/extensions/xep-</xsl:text>
        <xsl:value-of select='.' />
        <xsl:text>.html</xsl:text>
      </xsl:attribute>
      XEP-<xsl:value-of select='.'/>
    </a>
  </xsl:template>

--------------

<!-- Include it in all the presentational groups in the xsd. -->

It made my life a little easier. I am sure you could even write one that automagically handles footnotes etc.

e.g. <spec source='ietf' number='0001'>The Internet</spec>

Would result in:

<a href="#spec-ietf-0001'>[RFC 0001]</a>

And in the footer:

[<a href="http://www.ietf.org/rfc/rfc2119.txt">RFC 0001</a>] - The internet

Jonathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.jabber.org/jdev/attachments/20080523/a06ddbd6/attachment-0002.htm>


More information about the JDev mailing list