[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XSL, SQL, and trees (again)

Subject: Re: XSL, SQL, and trees (again)
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Thu, 27 Jul 2006 22:16:07 +0530
xsl sql
Hi Phill,
 Here is a XSLT 1.0 solution to convert,



  <directory name="About"/>
  <directory name="Services">
     <directory name="Environmental"/>
     <directory name="Landscaping"/>

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

<xsl:output method="xml" indent="yes"/>

<xsl:template match="/directories">
   <xsl:for-each select="item[(string-length(path) -
string-length(translate(path, '.', ''))) = 0]">
     <directory name="{name}">
       <xsl:call-template name="re-arrange">
         <xsl:with-param name="nodeset" select="../item" />
         <xsl:with-param name="curr-path" select="path" />
         <xsl:with-param name="no-of-dots" select="1" />

<xsl:template name="re-arrange">
 <xsl:param name="nodeset" />
 <xsl:param name="curr-path" />
 <xsl:param name="no-of-dots" />

 <xsl:for-each select="$nodeset[((string-length(path) -
string-length(translate(path, '.', ''))) = $no-of-dots) and
(starts-with(path, $curr-path))]">
   <directory name="{name}">
     <xsl:call-template name="re-arrange">
      <xsl:with-param name="nodeset" select="$nodeset" />
      <xsl:with-param name="curr-path" select="path" />
      <xsl:with-param name="no-of-dots" select="$no-of-dots + 1" />





On 7/27/06, Phillip B Oldham <phillip.oldham@xxxxxxxxxx> wrote:
Hi all

I've been looking at the different methods for working with storing
trees in SQL.

At the moment, I'm looking at the 'Materialized Path' technique, and
have a couple of questions regarding XSL.

If I were to have a table along the following lines:

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.