[daisy] conditionally show text on document

Parisi, Lou Lou.Parisi at photomask.com
Thu Sep 13 14:09:43 CDT 2007


First let me apologize to this list for my many questions in the last
week and thank you for your answers you have given me.  I hope you can
give me a little more help.

 

I have created a daisy wiki home page and much of the information is not
visible if the user is not logged in.  I would like to conditionally
show some text to tell the user login with a link to the login if the
user is guest.  

 

I found from some of the source stylesheets these snippets and tried to
user them but they don't seem to work for a SimpleDocument.  

 

<xsl:import href="daisyskin:xslt/document-to-html.xsl"/>

  <xsl:variable name="user" select="page/context/user"/>

  <xsl:variable name="login" select="$user/login"/>

  <xsl:variable name="onlyGuestRole"
select="boolean($user/activeRoles/role[@name='guest']) and
count($user/activeRoles/role) = 1"/>

  <xsl:variable name="siteName"
select="string(page/context/site/@name)"/>

    

  <xsl:template match="d:document">    

            <xsl:apply-templates select="d:parts/d:part"/>

            <xsl:apply-templates select="d:links"/>

            <xsl:apply-templates select="d:fields"/>  

            

            <xsl:text>test for user</xsl:text>

            <p>user=<xsl:value-of select="$user"/></p>

            <p>login=<xsl:value-of select="$login"/></p>

            <p>onlyGuestRole=<xsl:value-of select="$onlyGuestRole"/></p>

            <p>site=<xsl:value-of select="$siteName"/></p>

            <xsl:if test="($onlyGuestRole)">

                        <xsl:text>guest</xsl:text>

            </xsl:if>

            

</xsl:template>

 

The variables $user, $login, and $siteName are empty when I use this as
a stylesheet for a SimpleDocument.

 

What is the best way to determine if a user is guest on a SimpleDocument
so that I can conditionally show text?

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cocoondev.org/pipermail/daisy/attachments/20070913/5c051241/attachment-0001.htm


More information about the daisy mailing list