This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Show - hide with xslt?


On Thu, 24 Aug 2000, Andrea Penna wrote:

>       <xsl:variable name="my_id"><xsl:value-of select="generate-id()"/>
> </xsl:variable>
> 
>       <div style="display:none">
>       <xsl:attribute name="id"><xsl:value-of
> select="$my_id"/></xsl:attribute>
[...]
>       </div>
> 
>       <a>
>       <xsl:attribute name="href">javascript:showhide('<xsl:value-of
> select="$my_id"/>');</xsl:attribute>
[...]
>       </a>

As usual, you can write it far more simpler and cleaner (to my sense)
using attribute value templates...

<xsl:variable name="my-id" select="generate-id()"/>
<div style="display:none" id="{$my-id}">
[...]
</div>
<a href="javascript:showhide('{$my-id}');">
[...]
</a>

Hope this helps.

                             -- David --

PS: thanks for the JavaScript snippet, I've been looking for a way of
doing this for a long time, but I'm completely clueless about all the
JavaScript and DOM voodoo needed.



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]