Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Need simple example (please help)

From: "Han" <hp4444@------.---.----->
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
>
>




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent