Subject:LGCL XSLT transformation Author:Phil Patch Date:03 Oct 2006 01:15 PM Originally Posted: 03 Oct 2006 01:14 PM
Hi,
I am currently evaluating your product with a problem i am having with a customer. I am quite new to XML / XSLT but am needing to transform the governemt LGCL.xml to display in a tree like structure.
My query is how can i use XSLT to sort the XML document into this tree structure.
ie -
each item has an ID, and a possible broader term. this broader term will then link to an item Id and should appear below the item it links too..
example XML below:
<Item Id="49" ConceptId="49" Obsolete="false"
AddedinVersion="2.00" LastUpdatedInVersion="2.00"
AToZ="false" Category="true" Preffered="true">
<Name>Children looked after in care</Name>
<ScopeNotes>Information on children in care.</ScopeNotes>
<BroaderItem Id="35" ConceptId="35" Default="true">Children and families services</BroaderItem>
</Item>
<Item Id="50" ConceptId="50" Obsolete="false"
AddedinVersion="2.00" LastUpdatedInVersion="2.00"
AToZ="false" Category="true" Preffered="true">
<Name>Registration</Name>
<ScopeNotes>Consolidated listing of children looked after in care.</ScopeNotes>
<BroaderItem Id="49" ConceptId="49" Default="true">Children looked after in care</BroaderItem>
</Item>
I believe the key parts are:
1. First apply-templates to all the main ControlledList elements. that is, the ones without a BroaderItem.
2. Then recursively apply templates to all of those.