Subject: Re: [xsl] Seeking an elegant implementation of a graph traversal From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Sat, 08 Oct 2011 18:49:59 +0200 |
I have a Document consisting of a bunch of Sections. Each Section has a unique identifier. Each Section may reference other Sections via an Include element, e.g.,
<Document> <Section id="A"> <Include idref="B" /> <Include idref="C" /> </Section> <Section id="B"> <Include idref="D" /> </Section> <Section id="C"> <Include idref="D" /> </Section> <Section id="D"> <Include idref="A" /> </Section> <Section id="E" /> </Document>
Problem: Write a function and pass a Section to it. The function outputs the Section and all the Sections it Includes and all the Sections each of them Includes, and so on.
Be sure there are no duplicates in the output.
Example: invoke the function with Section A. Here's the output:
A, B, C, D
Is there an elegant XSLT implementation of this graph traversal problem?
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mf="http://example.com/mf" version="2.0" exclude-result-prefixes="xs mf">
Martin Honnen --- MVP Data Platform Development http://msmvps.com/blogs/martin_honnen/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Seeking an elegant implementa, Costello, Roger L. | Thread | RE: [xsl] Seeking an elegant implem, Costello, Roger L. |
[xsl] Seeking an elegant implementa, Costello, Roger L. | Date | RE: [xsl] Seeking an elegant implem, Costello, Roger L. |
Month |