Hello,
The following RDF models a hierarchical website of 7 nodes with a max
depth of 2. I would like to transform it into a text file containing
each path through the site, one per line, where a path is a space
delimited sequence of hyperlink labels from the root of the site to a
leaf.
Therefore, for the following RDF data, I'd like to produce:
--
a d
a e
b f
b g
c h
--
Can xslt realize this transformation? The problem is challenging
because 1) the RDF data models a DAG (directed acyclic graph), due to
the presence of crosslinks, rather than just a tree, and 2) there is no
way to associate any node with its parents and therefore the processing
must proceed in a top-down, rather than bottom-up, fashion. Top-down
processing is generally convenient when things are nested, but they are
not in this case.
<RDF xmlns:r="http://www.w3.org/TR/RDF/"
xmlns:d="http://purl.org/dc/elements/1.0/">
<Node r:id="Root">
<num>1</num>
<d:Title>Root</d:Title>
<link r:resource="Root/a"></link>
<link r:resource="Root/b"></link>
<link r:resource="Root/c"></link>
</Node>
<Node r:id="Root/a">
<num>2</num>
<d:Title>a</d:Title>
<link r:resource="Root/a/d"></link>
<link r:resource="Root/a/e"></link>
</Node>
<Node r:id="Root/b">
<num>3</num>
<d:Title>b</d:Title>
<link r:resource="Root/b/g"></link>
<crosslink r:resource="f:Root/a/e"></symbolic>
</Node>
<Node r:id="Root/c">
<num>4</num>
<d:Title>c</d:Title>
<crosslink r:resource="h:Root/b/g"></link>
</Node>
<Node r:id="Root/a/d">
<num>5</num>
<d:Title>d</d:Title>
</Node>
<Node r:id="Root/a/e">
<num>6</num>
<d:Title>e</d:Title>
</Node>
<Node r:id="Root/b/g">
<num>7</num>
<d:Title>g</d:Title>
</Node>
</RDF>
I am currently learning RDF. I realize that this question and problem
may be better suited for an RDF list and RDF parser/manipulator,
respectively. If that is the case, I apologize in advance.
Thank You and Best Regards,
Saverio
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list