This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Re: expandble list in XSL
- To: xsl-list at mulberrytech dot com
- Subject: Re: Re: expandble list in XSL
- From: "Johan Andreasson" <johan_andreasson at hotmail dot com>
- Date: Thu, 30 Mar 2000 09:56:58 PST
- Reply-To: xsl-list at mulberrytech dot com
Thanks for the quick reply Dan,
As you pointed out it isn't easy to help without knowing the problem.
This is how I would like to do it, if it's possible:
1. Here, I would need a vector, something like: var exposed= new
array(document.length);
But then, I have to be able to get the number of a ceratin node,
something like an inverse to the item(index) function.
2. If i write like this, obj.id get the value: <value-of> and of course that
is not what I want.
Thanks in advance
XSL-file:
--------------
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<HTML>
<HEAD>
<SCRIPT>
var exposed=false; <---- 1.
function show_details(obj)
{
if ( exposed == false ) // expand the list
{
obj.insertAdjacentHTML("BeforeEnd",
document.all[obj.id+"details"].innerHTML); <---- 2.
eval("exposed=true");
}
else // collapse the list
{
obj.children[0].outerHTML='';
eval("exposed=false");
}
}
</SCRIPT>
</HEAD>
<BODY>
<xsl:apply-templates select="//ITEM" />
<H1>Rubrik</H1>
<P>
<xsl:apply-templates select="//ITEM/NAME" />
</P>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="ITEM/NAME">
|---2.
<P ID="<xsl:value-of>"
ONCLICK="show_details(this)"><B><xsl:value-of/></B></P>
</xsl:template>
<xsl:template match="ITEM" >
|---2.
<DIV ID="<xsl:value-of >details" STYLE="display: none"><UL>
<LI><xsl:value-of select="DET1"/></LI><LI><xsl:value-of
select="DET2"/></LI><LI><xsl:value-of select="DET3"/></LI></UL></DIV>
</xsl:template>
</xsl:stylesheet>
XML-file:
-----------
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="explist.xsl"?>
<ITEMLIST>
<ITEM>
<NAME>item 1</NAME>
<DET1>sf...</DET1>
<DET2>..df.</DET2>
<DET3>..asd.</DET3>
</ITEM>
..
..more items
</ITEMLIST>
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list