p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   XSLT (http://p2p.wrox.com/forumdisplay.php?f=86)
-   -   XML structure for easy XSLT (http://p2p.wrox.com/showthread.php?t=47609)

coldstar September 9th, 2006 10:52 PM

XML structure for easy XSLT
 
I'm in the process of building some XML that will subsequently be transformed by XLST into HTML in the form of tables.

Am I correct in saying that the XML needs to be well structured to efficiently use XSLT for the transformation?

For example, I should be structuring the XML such that it flows into a table row by row using the for-each construct right?

Something like this:
<root>
  <row>
    <columns>
    <columns>
    ...

etc.

mhkay September 10th, 2006 06:35 AM

Yes, the more the structure of the data is explicit in the XML tagging, the easier it will be to process it in XSLT. For example it's much easier to process

<section>
  <title/><p/><p/><p/>
</section>
<section>
  <title/><p/><p/><p/>
</section>

than

<title/><p/><p/><p/><title/><p/><p/><p/>

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

coldstar September 10th, 2006 04:09 PM

Thanks - appreciated.



All times are GMT -4. The time now is 12:00 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.