Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Relational and Recursive Data using XSL?

I have a recursive definition of "groups" table. where each record represents
a group and can be a subgroup of another record also. i have a parent field
in this table, representing the parent record of a group. i have this data
in a generated XML document.
can i render the data in "tree" like structure using XSL? doing some logic
in ASP and generating the data in tree-form is possible, but can i do it
using XSL??

thanks,
rohit
[468 byte] By [Rohit Wason] at [2007-11-9 14:54:37]
# 1 Re: Relational and Recursive Data using XSL?
Rohit,

The new MSFT XML preview parser works recursively for me. Previous versions
had some issues with recursive XSL sorting, but I can't remember which ones.

Basically, I would use a 'first' xsl:apply-templates statement, then within
the xsl:template tags, another xsl:apply-templates statement to recurs.

FWIW,

Greg Longtin

"Rohit Wason" <rohitw@futuresoftindia.com> wrote in message
news:38f44237$1@news.dev-archive.com...
>
> I have a recursive definition of "groups" table. where each record
represents
> a group and can be a subgroup of another record also. i have a parent
field
> in this table, representing the parent record of a group. i have this data
> in a generated XML document.
> can i render the data in "tree" like structure using XSL? doing some logic
> in ASP and generating the data in tree-form is possible, but can i do it
> using XSL??
>
> thanks,
> rohit
Greg Longtin at 2007-11-11 23:33:56 >
# 2 Re: Relational and Recursive Data using XSL?
all right greg,
but what I'm refering to here is something else!
I have a SQL table, which has a "parent" field, which refers to the parent
record of a single record (like we have in Employee Table, where typically,
a field called "Manager" stores the EmpID of the manager of an employee)

What I've got as XML is a non-heirarcical (non-recursive) serialized list
of my records. I want to "render" them as heirarchy thru XSL.
Is that possible?
Rohit

"Greg Longtin" <longtin@att.net> wrote:
>Rohit,
>
>The new MSFT XML preview parser works recursively for me. Previous versions
>had some issues with recursive XSL sorting, but I can't remember which ones.
>
>Basically, I would use a 'first' xsl:apply-templates statement, then within
>the xsl:template tags, another xsl:apply-templates statement to recurs.
>
>FWIW,
>
>Greg Longtin
Rohit Wason at 2007-11-11 23:35:03 >
# 3 Re: Relational and Recursive Data using XSL?
Rohit,

Yes, as I said, XSL will do this with a 'linear' list. Your inner
recursive test would select all employees with their manager as the
current node. Your initial test would select all employees with no
manager. IOW, same tests and iterations that one would use in code.
Note that your EmpID column could be declared as an xml id, and the
managerID could be an xml idref. At present, the xsl id() allows
finding a match to an idref (or idrefs). In the future, xsl may have a
function that works from id's to idref(s). Restated, the inner test
must check all employee nodes for matches, and hence, for a large list
may not be terribly speedy...

Greg Longtin

Rohit Wason <rohitw@futuresoftindia.com> wrote in message
news:38f54ddf@news.dev-archive.com...
>
> all right greg,
> but what I'm refering to here is something else!
> I have a SQL table, which has a "parent" field, which refers to the
parent
> record of a single record (like we have in Employee Table, where
typically,
> a field called "Manager" stores the EmpID of the manager of an
employee)
>
> What I've got as XML is a non-heirarcical (non-recursive) serialized
list
> of my records. I want to "render" them as heirarchy thru XSL.
> Is that possible?
> Rohit
Greg Longtin at 2007-11-11 23:35:57 >
# 4 Re: Relational and Recursive Data using XSL?
Do you have a sample XML snippet? I might be able to give you a sample
XSL that does what you want...
-Blake
"Rohit Wason" <rohitw@futuresoftindia.com> wrote:
>
>all right greg,
>but what I'm refering to here is something else!
>I have a SQL table, which has a "parent" field, which refers to the parent
>record of a single record (like we have in Employee Table, where typically,
>a field called "Manager" stores the EmpID of the manager of an employee)
>
>What I've got as XML is a non-heirarcical (non-recursive) serialized list
>of my records. I want to "render" them as heirarchy thru XSL.
>Is that possible?
>Rohit
>
>
>"Greg Longtin" <longtin@att.net> wrote:
>>Rohit,
>>
>>The new MSFT XML preview parser works recursively for me. Previous versions
>>had some issues with recursive XSL sorting, but I can't remember which
ones.
>>
>>Basically, I would use a 'first' xsl:apply-templates statement, then within
>>the xsl:template tags, another xsl:apply-templates statement to recurs.
>>
>>FWIW,
>>
>>Greg Longtin
>
Blake Payne at 2007-11-11 23:37:06 >