[jdev] XEP XSL

Peter Saint-Andre stpeter at stpeter.im
Tue Jun 3 17:17:09 CDT 2008


Thanks. Is this <spec> element different from the one in the <head> of
the document?

On 05/23/2008 5:09 AM, Jonathan Dickinson wrote:
> 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 --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 7338 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://www.jabber.org/jdev/attachments/20080603/a8eeb938/attachment-0002.bin>


More information about the JDev mailing list