Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - REQ: Need simple example (please help) >Thread Next - Re: Need simple example (please help) Re: Need simple example (please help)To: NULL Date: 10/2/2004 11:56:00 PM Try this xslt. I have written/tested with the following xml.
<a>
<b>
<c>c1</c>
<c>c2</c>
</b>
</a>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
>
<xsl:output method='xml'
indent='yes' omit-xml-declaration='yes'/>
<xsl:template match="/">
<html><head>
<style>
div {width:3cm; margin-top:1mm;}
span {background-color:yellow; margin-right:1mm; cursor:default;}
</style>
<script>
function click1(th) {
var ch1=th.children(0).innerText;
if (ch1 == "+") {
th.children(0).innerText="-";
th.nextSibling.style.display="block";
}
if (ch1 == "-") {
th.children(0).innerText="+";
th.nextSibling.style.display="none";
}
}
</script>
</head><body>
<xsl:apply-templates select='*'/>
</body></html>
</xsl:template>
<xsl:template match='*'>
<div onclick="click1(this)">
<span>+</span>
<xsl:value-of select='name()'/>
</div>
<div style='display:none; margin-left:1cm;'>
<xsl:apply-templates select='node()'/>
</div>
</xsl:template>
</xsl:stylesheet>
"Stefanie" <Stefanie@m...> wrote in message
news:uzNmyfxpEHA.2484@T......
> I'am new to XML / XSL.
> I'am looking for a simple treeview XML/XSL example.(XML and XSL file)
>
> Somthing like: + Parent 1
> - child 1
> - child 2
> + Parent 2
> - child 1
> - child 2
>
> Where you can click the "+" to expand the tree.
>
> Stefanie
>
>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
