Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xml-dev] xslt for hierarchical data

From: "Michael Kay" <mike@--------.--->
To: "'Jody Robert Ford'" <jody.r.ford@-----.--->,<xml-dev@-----.---.--->
Date: 1/10/2006 9:59:00 AM
XSLT coding questions are better asked on the xsl-list at 
mulberrytech. This one comes up quite often.
 
A record is a logical root if it is named in an @parent 
attribute but does not appear in the content of any <record> 
element.
 
For each logical root, apply-templates to its logical 
children.
 
The logical children of a record R are those whose @parent 
attribute matches the string value of R.
 
The template rule for record adds a hierarchic level (e.g. 
by creating an element, or by creating indentation), outputs the string value 
of that record, and then applies-templates to the logical children of the 
record.
 
You can use keys to make the search for the logical 
children of a record more efficient.
 
Michael Kay
http://www.saxonica.com/


  
  
  From: Jody Robert Ford 
  [mailto:jody.r.ford@g...] 
Sent: 09 January 2006 
  23:39
To: xml-dev@l...
Subject: [xml-dev] xslt 
  for hierarchical data


  
  
  Given a data 
  structure:<o:p></o:p>
  <o:p> </o:p>
  <record id=1 
  parent=”Jack”>Jack Jr</record><o:p></o:p>
  <record id=4 
  parent=”Jack”>William</record><o:p></o:p>
  <record id=3 parent=”Jack 
  Jr”>Jack III</record><o:p></o:p>
  <record id=7 
  parent=”William”>William Jr.</record><o:p></o:p>
  <record id=7 parent=”William 
  Jr”>William III</record><o:p></o:p>
  <record id=7 parent=”William 
  III”>William IV</record><o:p></o:p>
  <o:p> </o:p>
  How do I 
  get…<o:p></o:p>
  <o:p> </o:p>
  Jack<o:p></o:p>
              
  Jack Jr.<o:p></o:p>
                          
  Jack III<o:p></o:p>
              
  William             
  <o:p></o:p>
                          
  William Jr.         
  <o:p></o:p>
                                      
  William III<o:p></o:p>
                                                  
  William IV<o:p></o:p>
  <o:p> </o:p>
  Special problems. 
  <o:p></o:p>
  
    The number of 
    generations can be infinite.<o:p></o:p> 
    Please note I don’t 
    have a Jack record, but I need to display Jack.<o:p></o:p> 
    
  <o:p> </o:p>
  <o:p> </o:p>
  Anyone got any 
  ideas?<o:p></o:p>
  <o:p> </o:p>
  Thanks,<o:p></o:p>
  <o:p> </o:p>
  Jody<o:p></o:p>
  <o:p> </o:p>
  <o:p> </o:p>
  <o:p> </o:p>


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent