cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@socialchange.net.au
Subject Re: .XML-tree lookup problem
Date Mon, 01 Jan 2001 02:27:07 GMT

You'd have better luck on the mulberrytech XSLT list. This doesn't sound
Cocoon-specific.

Perhaps if you expressed your class hierarchy in XMI
 (http://www.oasis-open.org/cover/xmi.html), you could find a standard
XMI->HTML stylesheet which you could modify to do what you want.

--Jeff

> Hi all,
> 
> our problem is, maybe, very simple. But we don't know how to fix it.
> We have described a C++ class hierarchy in XML (see below) and want to
> display each class inheritance with its namespaces if given.
> But we don't know how.
> 
> Hopefully is there anyone knowing on how to solve that.
> For better understanding the output, please take a look at
> 
> Example code for class-hierarchy.xml:
> 
>   <class-hierarchy>
>     <class name="A">
>       <class name="B" namespace="D">
>         <mi>NS::C</mi> <!-- here he should automatically lookup the
> namespace -->
>       </class>
>     </class>
>   </class-hierarchy>
> 
> The <mi> tag allows to specify further base classes (mi=multiple
> inheritance). The above says that B is a class in namespace D whose base
> classes are A and C.
> 
> A code extract from the class-hierarchy.xsl:
> 
>    <!-- this templates prints the class hierarchy and its
>             -->
>    <xsl:template match="class-hierarchy//class/mi">
>     <a>
>       <xsl:attribute name="href">
>         <xsl:text>#descr_</xsl:text>
>         <xsl:value-of select="."/>
>       </xsl:attribute>
>       <xsl:value-of select="."/> /****/
>     </a>
>   </xsl:template>
> 
> This defines an internal link to an anchor. The anchor's name consists of
> the prefix "descr_" and the class name. The problem is that the class C
> resides in the namespace NS. Thus, the above will not work because
> namespaces are not part of the anchor name. We therefore tried to replace
> the line marked with /****/ by the following:
> 
> <xsl:apply-templates select="//class[@name=self::text()]/@name"/>
> 
> There is a template for class/@name which prints out the namespace and the
> name of the class. The reason why we didn't put the namespace part into the
> name was to optically differentiate between both. Namespace names are
> printed in dark gray to make the class names stick out more.
> 
> Anyway, the line above does not work correctly. It evaluates to nothing
> instead. Even just retrieving the name by this
> 
> <xsl:value-of select="//class[@name=self::text()]/@name"/>
> 
> will not work. Curiously, when giving the class name statically like the
> following, it will work:
> 
> <xsl:value-of select="//class[@name='A']/@name"/>
> 
> results in "A".
> 
> Any help would be greatly appreciated.
> 
> Happy new year,
> 
> Christian Parpart


Mime
View raw message