PDA

View Full Version : [jdev] XEP XSL


Jonathan Dickinson
05-23-2008, 01:11 PM
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

Peter Saint-Andre
06-04-2008, 12:18 AM
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
>

_______________________________________________
JDev mailing list
FAQ: http://www.jabber.org/discussion-lists/jdev-faq
Forum: http://www.jabberforum.org/forumdisplay.php?f=20
Info: http://mail.jabber.org/mailman/listinfo/jdev
Unsubscribe: JDev-unsubscribe (AT) jabber (DOT) org
_______________________________________________

Jonathan Dickinson
06-04-2008, 09:17 AM
No it isn't. You can have a look at what I did at http://svn.mosa.ensemble-os.org/rfc/tools

> -----Original Message-----
> From: jdev-bounces (AT) jabber (DOT) org [mailto:jdev-bounces (AT) jabber (DOT) org] On Behalf Of
> Peter Saint-Andre
> Sent: 04 June 2008 12:17 AM
> To: Jabber/XMPP software development list
> Subject: Re: [jdev] XEP XSL
>
> 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
> >
_______________________________________________
JDev mailing list
FAQ: http://www.jabber.org/discussion-lists/jdev-faq
Forum: http://www.jabberforum.org/forumdisplay.php?f=20
Info: http://mail.jabber.org/mailman/listinfo/jdev
Unsubscribe: JDev-unsubscribe (AT) jabber (DOT) org
_______________________________________________