You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Andreas Hartmann <an...@apache.org> on 2003/11/11 15:04:03 UTC

Re: Feature Att(Hack) - Use title attribute in sitetree/navigation transformation

Rolf Kulemann wrote:

> Hello List,
> 
> in order to provide the user with small summaries of link destinations
> one should use @title tag of <a> tag. The summary will be displayed as
> tooltips in a browser.

Thank you for your efforts!

But - wouldn't it make sense to use the dublin core description
element for this purpose? I think the sitetree shouldn't contain more
information than necessary.

-- Andreas

> I introduced a new tag called <summary> to sitetree.xml and appropiate
> to [sitetree2nav, menu, tabs].xsl.
> 
> At the moment one has to add the <summary> tags by hand into
> sitetree.xml. I will provide you with a better solution soon, which
> poulates the <summary> tag when editing/creating a doc via the CMS ui.
> 
> See attached files for more details.
> 
> Have fun :-)
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> 
> <!--
>     Document   : menu.xsl
>     Created on : 10. April 2003, 17:26
>     Author     : andreas
>     Description:
>         Purpose of transformation follows.
> -->
> 
> <xsl:stylesheet version="1.0"
>     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>     xmlns:nav="http://apache.org/cocoon/lenya/navigation/1.0"
>     xmlns="http://www.w3.org/1999/xhtml"
>     exclude-result-prefixes="nav"
>     >
>     
> 
> <xsl:template match="nav:site">
>   <div id="menu">
>     <xsl:apply-templates select="nav:node"/>
>   </div>
> </xsl:template>
> 
> 
> <xsl:template match="nav:node">
>   <xsl:choose>
>     <xsl:when test="descendant-or-self::nav:node[@current = 'true']">
>       <div class="menublock-selected-{count(ancestor-or-self::nav:node)}">
>         <xsl:call-template name="item"/>
>         <xsl:apply-templates select="nav:node"/>
>       </div>
>     </xsl:when>
>     <xsl:otherwise>
>       <div class="menublock-{count(ancestor-or-self::nav:node)}">
>         <xsl:call-template name="item"/>
>         <xsl:apply-templates select="nav:node"/>
>       </div>
>     </xsl:otherwise>
>   </xsl:choose>
> </xsl:template>
> 
> 
> <xsl:template name="item">
>     <xsl:choose>
>       <xsl:when test="@current = 'true'">
>         <xsl:call-template name="item-selected"/>
>       </xsl:when>
>       <xsl:otherwise>
>         <xsl:call-template name="item-default"/>
>       </xsl:otherwise>
>     </xsl:choose>
> </xsl:template>
> 
> 
> <xsl:template name="item-default">
>   <div class="menuitem-{count(ancestor-or-self::nav:node)}">
> 	<!-- RKUPATCH -->
>     <a href="{@href}" title="{@title}"><xsl:apply-templates select="nav:label"/></a>
> 	<!-- /RKUPATCH -->
>   </div>
> </xsl:template>
>     
>     
> <xsl:template name="item-selected">
>   <div class="menuitem-selected-{count(ancestor-or-self::nav:node)}">
>     <xsl:apply-templates select="nav:label"/>
>   </div>
> </xsl:template>
> 
> 
> <xsl:template match="nav:label">
>   <xsl:value-of select="."/>
> </xsl:template>
>     
>     
> <xsl:template match="@*|node()">
>   <xsl:copy>
>     <xsl:apply-templates select="@*|node()"/>
>   </xsl:copy>
> </xsl:template>
> 
> 
> </xsl:stylesheet> 
> 
> 
> ------------------------------------------------------------------------
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> 
> <!--
>     Document   : stylesheet.xsl
>     Created on : 30. April 2003, 10:53
>     Author     : andreas
>     Description:
>         Purpose of transformation follows.
> -->
> 
> <xsl:stylesheet
>     version="1.0"
>     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>     xmlns:tree="http://apache.org/cocoon/lenya/sitetree/1.0"
>     xmlns:nav="http://apache.org/cocoon/lenya/navigation/1.0"
>     exclude-result-prefixes="tree"
>     >
> 
> <xsl:param name="url"/>
> <xsl:param name="chosenlanguage"/>
> <xsl:param name="defaultlanguage"/>
>     
> <xsl:variable name="path-to-context"><xsl:call-template name="create-path-to-context"/></xsl:variable>
>   
> <xsl:template name="create-path-to-context">
>   <xsl:param name="local-url" select="$url"/>
>   <xsl:if test="contains($local-url, '/')">
>     <xsl:text/>../<xsl:call-template name="create-path-to-context">
>       <xsl:with-param name="local-url" select="substring-after($local-url, '/')"/>
>     </xsl:call-template>
>   </xsl:if>
> </xsl:template>
> 
> 
> <xsl:template match="tree:site">
> 
>   <nav:site url="{$url}">
>     <xsl:copy-of select="@*"/> 
>     <xsl:apply-templates/>
>   </nav:site>
> 
> </xsl:template>
> 
> 
> <!--
> Resolves the existing language of a node, preferrably
> the default language.
> -->
> <xsl:template name="resolve-existing-language">
>   <xsl:choose>
>     <xsl:when test="tree:label[lang($chosenlanguage)]"><xsl:value-of select="$chosenlanguage"/></xsl:when>
>     <xsl:when test="tree:label[lang($defaultlanguage)]"><xsl:value-of select="$defaultlanguage"/></xsl:when>
>     <xsl:otherwise><xsl:value-of select="tree:label/@xml:lang"/></xsl:otherwise>
>   </xsl:choose>
> </xsl:template>
> 
> 
> 
> <!--
> Apply nodes recursively
> -->
> <xsl:template match="tree:node">
> 
>   <!-- basic url of parent node -->
>   <xsl:param name="previous-url" select="''"/>
>   
>   <xsl:variable name="existinglanguage">
>     <xsl:call-template name="resolve-existing-language"/>
>   </xsl:variable>
>   
>   <nav:node>
>   
>     <xsl:copy-of select="@id"/>
>     <xsl:copy-of select="@protected"/>
>   
>     <!-- basic url - for all nodes -->
>   
>     <xsl:variable name="basic-url">
>       <xsl:text/>
>       <xsl:choose>
>         <xsl:when test="@href">
>           <xsl:value-of select="@href"/>
>         </xsl:when>
>         <xsl:otherwise>
>           <xsl:value-of select="$previous-url"/><xsl:value-of select="@id"/>
>         </xsl:otherwise>
>       </xsl:choose>
>     </xsl:variable>  
>     
>     <xsl:variable name="language-suffix">
>       <xsl:text>_</xsl:text><xsl:value-of select="$existinglanguage"/>
>     </xsl:variable>
>     
>     <xsl:variable name="canonical-language-suffix">
>       <xsl:choose>
>         <xsl:when test="not($defaultlanguage = $existinglanguage)">
>           <xsl:value-of select="$language-suffix"/>
>         </xsl:when>
>         <xsl:otherwise>
>           <!-- no suffix for default language -->
>         </xsl:otherwise>
>       </xsl:choose>
>     </xsl:variable>
>     
>     <!-- suffix - only when @href is not present -->
>     
>     <xsl:variable name="suffix">
>       <xsl:if test="not(@href)">
>         <xsl:text>.</xsl:text>
>         <xsl:choose>
>           <xsl:when test="@suffix">
>             <xsl:value-of select="@suffix"/>
>           </xsl:when>
>           <xsl:otherwise>
>             <xsl:text>html</xsl:text>
>           </xsl:otherwise>
>         </xsl:choose>
>       </xsl:if>
>     </xsl:variable>
>     
>     <xsl:attribute name="suffix"><xsl:value-of select="$suffix"/></xsl:attribute>
>     <xsl:attribute name="basic-url"><xsl:value-of select="$previous-url"/><xsl:value-of select="@id"/></xsl:attribute>
>     <xsl:attribute name="language-suffix"><xsl:value-of select="$canonical-language-suffix"/></xsl:attribute>
>     
>     <xsl:variable name="canonical-url">
>       <xsl:text/>
>       <xsl:value-of select="$basic-url"/><xsl:text/>
>       <xsl:value-of select="$canonical-language-suffix"/><xsl:text/>
>       <xsl:value-of select="$suffix"/><xsl:text/>
>     </xsl:variable>
>     
>     <xsl:variable name="non-canonical-url">
>       <xsl:text/>
>       <xsl:value-of select="$basic-url"/><xsl:text/>
>       <xsl:value-of select="$language-suffix"/><xsl:text/>
>       <xsl:value-of select="$suffix"/><xsl:text/>
>     </xsl:variable>
>     
>     <xsl:if test="$url = $canonical-url or $url = $non-canonical-url">
>       <xsl:attribute name="current">true</xsl:attribute>
>     </xsl:if>
>     
>     <xsl:attribute name="href"><xsl:value-of select="concat($path-to-context, $canonical-url)"/></xsl:attribute>
> 	<!-- RKUPATCH -->
>     <xsl:attribute name="title"><xsl:value-of select="tree:summary[lang($existinglanguage)]"/></xsl:attribute>
> 	<!-- /RKUPATCH -->
>     <xsl:apply-templates select="tree:label[lang($existinglanguage)]">
>       <xsl:with-param name="previous-url" select="concat($basic-url, '/')"/>
>     </xsl:apply-templates>
>     
>     <xsl:apply-templates select="tree:node">
>       <xsl:with-param name="previous-url" select="concat($basic-url, '/')"/>
>     </xsl:apply-templates>
>     
>   </nav:node>
> </xsl:template>
> 
> 
> <xsl:template match="tree:label">
>   <nav:label>
>   	<xsl:copy-of select="@*"/>
>     <xsl:apply-templates/>
>   </nav:label>
> </xsl:template>
> 
> 
> <xsl:template match="@*|node()" priority="-1">
>   <xsl:copy>
>     <xsl:apply-templates select="@*|node()"/>
>   </xsl:copy>
> </xsl:template>
> 
> 
> </xsl:stylesheet> 
> 
> 
> ------------------------------------------------------------------------
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> 
> <!--
>     Document   : tabs.xsl
>     Created on : 10. April 2003, 17:26
>     Author     : andreas
>     Description:
>         Purpose of transformation follows.
> -->
> 
> <xsl:stylesheet version="1.0"
>     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>     xmlns:nav="http://apache.org/cocoon/lenya/navigation/1.0"
>     xmlns="http://www.w3.org/1999/xhtml"
>     exclude-result-prefixes="nav"
>     >
> 
> 
> <xsl:template match="nav:site">
> 
>   <div id="tabs">
> 
>     <xsl:call-template name="pre-separator"/>
>     <xsl:for-each select="nav:node">
>       <xsl:if test="position() &gt; 1">
>         <xsl:call-template name="separator"/>
>       </xsl:if>
>       
>       <xsl:choose>
>         <xsl:when test="descendant-or-self::nav:node[@current = 'true']">
>           <xsl:call-template name="tab-selected"/>
>         </xsl:when>
>         <xsl:otherwise>
>           <xsl:call-template name="tab"/>
>         </xsl:otherwise>
>       </xsl:choose>
>         
>     </xsl:for-each>
>     <xsl:call-template name="post-separator"/>
>   </div>
> </xsl:template>
> 
> 
> <xsl:template name="tab">
>   <span class="tab"><xsl:call-template name="label"/></span>
> </xsl:template>
> 
> 
> <xsl:template name="tab-selected">
>   <span class="tab-selected"><xsl:call-template name="label"/></span>
> </xsl:template>
> 
> 
> <xsl:template name="label">
> 	<!-- RKUPATCH -->
>   <a href="{@href}" title="{@title}"><xsl:apply-templates select="nav:label"/></a>
> 	<!-- /RKUPATCH -->
> </xsl:template>
> 
> 
> <xsl:template match="nav:label">
>   <xsl:value-of select="."/>
> </xsl:template>
> 
> 
> <xsl:template name="pre-separator">
> </xsl:template>
> 
> 
> <xsl:template name="separator">
>    <xsl:text>&#160;</xsl:text>
> </xsl:template>
> 
> 
> <xsl:template name="post-separator">
> </xsl:template>
> 
> 
> <xsl:template match="@*|node()">
>   <xsl:copy>
>     <xsl:apply-templates select="@*|node()"/>
>   </xsl:copy>
> </xsl:template>
> 
> 
> </xsl:stylesheet> 
> 
> 
> ------------------------------------------------------------------------
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!--$Id: sitetree.xml,v 1.13 2003/07/28 20:11:02 gregor Exp $ -->
> <site xmlns="http://apache.org/cocoon/lenya/sitetree/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Authoring" xsi:schemaLocation="http://apache.org/cocoon/lenya/sitetree/1.0         ../../../../resources/entities/sitetree.xsd">
> 
>   <node id="index">
>     <label xml:lang="en">Home</label>
>     <label xml:lang="de">Startseite</label>
> 	<!-- Use dc:description for summary content later. Maybe use assets at all.
> 		Problem here is redundant data.
> 	-->
> 	<summary xml:lang="de">Startseite von www.xxxxx.com</summary>
> 	<summary xml:lang="en">Homepage of www.xxxxx.com</summary>
>   </node>
> <node id="service">
> 	<label xml:lang="de">Service</label>
> 	<label xml:lang="en">Service</label>
> 	<summary xml:lang="de">Beschreibung der Serviceleistungen wie EAI, SEO usw.</summary>
> 	<summary xml:lang="en">Read more about EAI and SEO</summary>
> </node>
> <node id="concepts">
> 	<label xml:lang="de">Konzepte</label>
> 	<label xml:lang="en">Concepts</label>
> 	<summary xml:lang="de">Entwicklungsstandards und genutzte Technologien wie J2EE, Apache, Cocoon und Lenya</summary>
> 	<summary xml:lang="en">Used development standards and technologies  like J2EE, Apache, Cocoon and Lenya</summary>
> </node>
> <node id="contact">
> 	<label xml:lang="en">Contact</label>
> 	<label xml:lang="de">Kontakt</label>
> <node id="test">
> 	<label xml:lang="de">test</label>
> 	<summary xml:lang="de">Test item</summary>
> </node>
> <node id="employees">
> 	<label xml:lang="de">Mitarbeiter</label>
> </node>
> <node id="anfahrt">
> 	<label xml:lang="de">Anfahrt</label>
> </node>
> </node>
> </site>
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lenya-dev-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: lenya-dev-help@cocoon.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-dev-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-dev-help@cocoon.apache.org


Re: Feature Att(Hack) - Use title attribute in sitetree/navigation transformation

Posted by Rolf Kulemann <ma...@rolf-kulemann.com>.
On Tue, 2003-11-11 at 15:04, Andreas Hartmann wrote:
> Rolf Kulemann wrote:
> 
> > Hello List,
> > 
> > in order to provide the user with small summaries of link destinations
> > one should use @title tag of <a> tag. The summary will be displayed as
> > tooltips in a browser.
> 
> Thank you for your efforts!
> 
> But - wouldn't it make sense to use the dublin core description
> element for this purpose? I think the sitetree shouldn't contain more
> information than necessary.

Yes, of course. The problem is to grap the dublin core info from each
doc attached to the site nodes. If you look to my documentation in the
files you will see that I have pointed that out already (redundant
data). I will provide a better solution in the near furture.

Sorry. 





-- 
Rolf Kulemann

You can tell how far we have to go, when FORTRAN is the language of
supercomputers.
		-- Steven Feiner


PGP/GPG public key:
	 http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x6B4EA7EA


---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-dev-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-dev-help@cocoon.apache.org


Re: Feature Att(Hack) - Use title attribute in sitetree/navigation transformation

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Rolf Kulemann wrote:

> Of course you are right. I'm working on it, but I have little time until
> end of this month (proofs). My main intention was to track my thoughts
> in bugzilla as proposed by the list. I hope I'm not wasting space on
> your bugzilla server :)

hey, not at all :) i very much like your ideas, and the fact that you 
back them up with code. keep'em coming.

-gregor

-- 
Gregor J. Rothfuss
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://wyona.com                   http://cocoon.apache.org/lenya
gregor.rothfuss@wyona.com                       gregor@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-dev-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-dev-help@cocoon.apache.org


Re: Feature Att(Hack) - Use title attribute in sitetree/navigation transformation

Posted by Rolf Kulemann <ma...@rolf-kulemann.com>.
On Tue, 2003-11-11 at 19:49, Gregor J. Rothfuss wrote:
> Andreas Hartmann wrote:
> > But - wouldn't it make sense to use the dublin core description
> > element for this purpose? I think the sitetree shouldn't contain more
> > information than necessary.
> 
> i'd also prefer to keep the sitetree lightweight. and reusing the dc 
> terms makes sense.

Of course you are right. I'm working on it, but I have little time until
end of this month (proofs). My main intention was to track my thoughts
in bugzilla as proposed by the list. I hope I'm not wasting space on
your bugzilla server :)

Thanks for your opinion.



-- 
Rolf Kulemann

Bagbiter:
	1. n.; Equipment or program that fails, usually
intermittently.  2. adj.:  Failing hardware or software.  "This
bagbiting system won't let me get out of spacewar."  Usage:  verges on
obscenity.  Grammatically separable; one may speak of "biting the
bag".  Synonyms: LOSER, LOSING, CRETINOUS, BLETCHEROUS, BARFUCIOUS,
CHOMPER, CHOMPING.


PGP/GPG public key:
	 http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x6B4EA7EA


---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-dev-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-dev-help@cocoon.apache.org


Re: Feature Att(Hack) - Use title attribute in sitetree/navigation transformation

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Andreas Hartmann wrote:
> But - wouldn't it make sense to use the dublin core description
> element for this purpose? I think the sitetree shouldn't contain more
> information than necessary.

i'd also prefer to keep the sitetree lightweight. and reusing the dc 
terms makes sense.

-gregor

-- 
Gregor J. Rothfuss
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://wyona.com                   http://cocoon.apache.org/lenya
gregor.rothfuss@wyona.com                       gregor@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-dev-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-dev-help@cocoon.apache.org