This is a simple example.

The tree (treetest.xml):
=========================

<?xml version="1.0" encoding="ISO-8859-1"?>
<document>
  <title>My tree</title>
  <u>
    <u>
      <utle>Heading 1</utle>
      <u>
          <utle>Heading 1a</utle>
      </u>
      <u>
          <utle>Heading 1b</utle>
      </u>
    </u>
    <u>
      <utle>Heading 2</utle>
      <u>
        <utle>Heading 2a</utle>
      </u>
    </u>
  </u>
</document>

The stylesheet (treetest.xsl)
=============================

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template match="/document">
<html>
<head>
<script src="../resources/ua.js"></script>
<script src="../resources/ftiens4.js"></script>
<script language="javascript">
  ICONPATH = '../resources/'
  foldersTree = gFld("<b>TEST</b>", "")
  <xsl:apply-templates select="u"/>
</script>

</head>
        <body>
    <script>initializeDocument()</script>
          <noscript>Enable JavaScript in your browser.</noscript>
        </body>
</html>
</xsl:template>

<xsl:template match="u"><xsl:apply-templates select="u"
mode="een"/></xsl:template>

<xsl:template match="u" mode="een">
        x1 = insFld(foldersTree, gFld( "<xsl:value-of select='utle'/>",""));
  <xsl:apply-templates select="u" mode="twee"/>
</xsl:template>

<xsl:template match="u" mode="twee">
        x2 = insDoc(x1, gLnk("R","<xsl:value-of select='utle'/>",""));
</xsl:template>

</xsl:stylesheet>

The sitemap
==================
<map:match pattern="resources/*">
    <map:read src="resources/{1}"/>
</map:match>
<map:match pattern="**/resources/*">
    <map:read src="{1}/resources/{2}"/>
</map:match>


<map:match pattern="prot/treetest.xml">
        <map:generate type="file" src="prot/treetest.xml"/>
  <map:transform src="stylesheets/treetest.xsl" />
  <map:serialize type="html"/>
</map:match>


Notes:
=========

The xml must be in a map "prot" relative to the location of the sitemap.
The xsl file must be in a map "stylesheets" relative to the sitemap
The resources (images and .js files) must be in a map "resources" relative
to the sitemap
Browse to ..../prot/treetest.xml to see the result.

Hope this helps

Hugo Burm

BTW:
- Please don't address your email to one person.
- This is all about xsl stylesheets and has nothing to do with cocoon.
Browse e.g. to www.zvon.org for tutorials about xml and xsl.
- Reconsider your footer about MSN Messenger (5 neue Buddies = 50 FreeSMS
etc.), some people may get suspicious.

> -----Original Message-----
> From: Johannes Becker [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 21, 2003 11:47 AM
> To: [EMAIL PROTECTED]
> Subject: @Hugo Burm: Got a xsl-stylesheet for the tree-view?
>
>
> Hi Hugo,
>
> I'm now working with the DHTML tree from http://www.treeview.net, as you
> are. I wonder if you got a xsl-stylesheet for the tree-view, that creates
> the the client side JavaScript? Could save me a lot of time.
>
>
> Regards
> Jonny
> ___________________________________________________
>
> Hi,
>
> I am using a DHTML tree from
> http://www.treeview.net
> to present an xml file.
>
> The Cocoon xsl stylesheet has to generate the client side Javascript
> functions like "insFld" that define the tree (see Treeview docs). And your
> client has to load the Treeview javascript library (ftiens4.js).
>
> Hugo Burm
>
> _________________________________________________________________
> 5 neue Buddies = 50 FreeSMS. http://messenger-mania.msn.de MSN Messenger
> empfehlen und kr�ftig abr�umen!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to