Hi
Does anybody know how do you process nodes within a tag that are nested to
an undefined depth.
I have a tag structure that looks like this:
<TaxonomyEntries>
- - -<TaxonomyNode> (1 to infinity)
- - - - - -<Description />
- - - - - -<TaxonomyNode /> (0 to infinity)
- - -<TaxonomyNode>
<TaxonomyEntries>
And I have some XML that looks like this:
<TopTag>
<TaxonomyEntries>
<TaxonomyNode name="Arbitrary Name"> -----Top Level Node
<Description>any description</Description>
<TaxonomyNode name="another name">
<TaxonomyNode name="yet another name">
<Description>any description</Description>
<TaxonomyNode name="and yet another name">
<Description>any description</Description>
</TaxonomyNode>
</TaxonomyNode>
</TaxonomyNode>
</TaxonomyNode>
<TaxonomyNode name="Arbitrary Name"> -----Top Level Node
<Description>any description</Description>
<TaxonomyNode name="another name">
<Description>any description</Description>
</TaxonomyNode>
</TaxonomyNode>
</TaxonomyEntries>
</TopTag>
I need to apply a stylesheet (XSL v2.0) to this XML to create a Table in
Word so that each Top Level TaxonomyNode is in a separate Table Row and
the children and childrens-children are all nested accordingly with their
descriptions displayed.
<w:tbl>
<w:tblPr>
<w:tblGrid>
<w:tr>
<TaxonomyEntries>
<w:tr>
<w:tc>
<w:p>
<TaxonomyNode name="Arbitrary Name">
<Description>
<w:r>
<w:t>any description</w:t>
</w:r>
</Description>
<TaxonomyNode name="another name">
<Description>
<w:r>
<w:t>any description</w:t>
</w:r>
</Description>
<TaxonomyNode name="yet another name">
<Description>
<w:r>
<w:t>any description</w:t>
</w:r>
</Description>
<TaxonomyNode name="and yet another name">
<Description>
<w:r>
<w:t>any description</w:t>
</w:r>
</Description>
</TaxonomyNode>
</TaxonomyNode>
</TaxonomyNode>
</TaxonomyNode>
</w:p>
</w:tc>
</w:tr>
<w:tr>
<w:tc>
<w:p>
<TaxonomyNode name="Arbitrary Name">
<Description>
<w:r>
<w:t>any description</w:t>
</w:r>
</Description>
<TaxonomyNode name="another name">
<Description>
<w:r>
<w:t>any description</w:t>
</w:r>
</Description>
</TaxonomyNode>
</TaxonomyNode>
</w:p>
</w:tc>
</w:tr>
</TaxonomyEntries>
<w:tbl>
Could any one give me some pointers on how to achieve this nesting. It
seems to me that some sort of recursion is in order but I'm not sure how
to implement it when there is no fixed depth to the nesting i.e there is
no break-out parameter.
Hopefully
Andy
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--