Re: crossreferences in installed xml



fre 2002-05-24 klockan 01.59 skrev Matthias Clasen:

Hi!

Sorry for jumping into the discussion so late (and I haven't had time to
read the entire thread.

First: Why should the ghelp:// uri scheme be used?

the ghelp: scheme only looks up documents in $PREFIX/share/gnome/help

Second: This has nothing to do with yelp. Yelp is going to filter out
any API documents that are in scrollkeeper since you don't want the user
to get them when trying to find help about there apps. 

I like the idea of using OMF+scrollkeeper for the API docs, that way I
can use this in Devhelp and finally getting rid of the devhelp books
which I've never liked.

I would like to have a better URI scheme for docs in scrollkeeper so
that you could do GNOME/APIref/Gtk+/GtkWidget or something to get to the
GtkWidget document.

Regards,
  Mikael Hallendal

> Here is my current attempt at link-conversion in xsl. The general
> approach is the following: 
> 
> Copy everything except link elements.
> For link elements, check if the linkend is a valid idref. If it is,
> copy it. Otherwise check the documents listed in index.xml to see if
> one of them contains the id. In that case, construct a ulink using the
> url found in index.xml and the id. Otherwise construct a man: ulink.
> 
> The index.xml contains a list of docbook files together with uri like
> this:
> 
> <index>
>   <document uri="ghelp://test/test.xml">test/test.xml</document>
>   <document uri="ghelp://test2/test2.xml">test2/test2.xml</document>
> </index>
> 
> Since this is my first xsl stylesheet, and it is only tested on toy
> examples so far. I would welcome comments on the general strategy and
> the actual implementation from more experienced xsl coders.
> 
> Matthias
> 
> 
> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> version="1.0">
>   <xsl:param name="index" select="'index.xml'"/>
> 
>   <xsl:output method="xml"
> 	      doctype-public="-//OASIS//DTD DocBook XML V4.1.2//EN"
> 	     
> doctype-system="http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"/>
> 
>   <xsl:template name="copy" match="*">
>     <xsl:copy>
>       <xsl:apply-templates select="@*"/>
>       <xsl:apply-templates/>
>     </xsl:copy>
>   </xsl:template>
> 
>   <xsl:template match="@*">
>     <xsl:attribute name="{name()}">
>       <xsl:value-of select="."/>
>     </xsl:attribute>
>   </xsl:template>
> 
>   <xsl:template match="//link">
>     <xsl:variable name="linkend" select="@linkend"/>
>     <xsl:variable name="linktext">
>       <xsl:apply-templates/>
>     </xsl:variable>
>     <xsl:variable name="emitted">
>       <xsl:choose>  
>         <xsl:when test="id(@linkend)">
>           <xsl:call-template name="copy"/>
>         </xsl:when>
>         <xsl:otherwise>
>           <xsl:for-each select="document($index)/index/document">
>             <xsl:variable name="uri" select="@uri"/>
> 	      <xsl:for-each select="document(text())">
>                 <xsl:if test="id($linkend)">
>                   <xsl:element name="ulink">
>                     <xsl:attribute name="url">
>                       <xsl:value-of select="concat($uri, '#',
> $linkend)"/>
>                     </xsl:attribute>
>                     <xsl:value-of
> select="$linktext"/>                       
>                   </xsl:element>
>                 </xsl:if>
>               </xsl:for-each>
>             </xsl:for-each>
>           </xsl:otherwise>
>         </xsl:choose>
>       </xsl:variable>
>     <xsl:choose> 
>       <xsl:when test="count($emitted)">
>         <xsl:copy-of select="$emitted"/>
>       </xsl:when>
>       <xsl:otherwise>
>         <xsl:element name="ulink">
>           <xsl:attribute name="url">
>             <xsl:value-of select="concat('man:', $linkend)"/>
>           </xsl:attribute>
>           <xsl:value-of select="$linktext"/>                       
>         </xsl:element>
>       </xsl:otherwise>
>     </xsl:choose>
>   </xsl:template>
> 
> </xsl:stylesheet>
> 
> 
> 
> _______________________________________________
> gtk-doc-list mailing list
> gtk-doc-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-doc-list
> 
-- 
Mikael Hallendal                micke codefactory se
CodeFactory AB                  http://www.codefactory.se/
Office: +46 (0)8 587 583 05     Cell: +46 (0)709 718 918




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]