Tony,

Your XML element and attribute names should describe the meaning of the data rather 
than how it should be displayed. Otherwise in the example you give, you might as well 
use a flat text file for storage. Use XML to describe the data, and let XSL handle the 
presentation! 

<?xml version="1.0"?>
<people>
  <person id="1">
    <name>Charlie</name>
    <pet>Horse</pet>
    <age>10</age>
    <phrase>Richter Scale</phrase>
  </person>
  <person id="2">
    <name>Ben</name>
    <pet>Iguana</pet>
    <age>26</age>
    <phrase>Something</phrase>
  <person>
</people>

---

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<xsl:output omit-xml-declaration="yes" indent="no"/>
 <xsl:template match="/people/person">
  <tr><td><xsl:value-of select="@id" /></td>
   <xsl:for-each select="*">
     <td><xsl:value-of select="." /></td>
   </xsl:for-each>
  </tr>
 </xsl:template>
</xsl:stylesheet>


---

produces:
<tr><td>1</td><td>Charlie</td><td>Horse</td><td>10</td><td>Richter Scale</td></tr>
<tr><td>2</td><td>Ben</td><td>Iguana</td><td>26</td><td>Something</td></tr>


there are of course multiple ways to achieve what you require - this is just one 
suggestion. Perhaps you don't have control over the XML data you're working with.

regards,
Ben


> -----Original Message-----
> From: Tony Weeg [mailto:[EMAIL PROTECTED]]
> Sent: 11 September 2002 04:17
> To: CF-Talk
> Subject: ot: xsl/xslt
> 
> 
> does anyone have a good background in xsl/xslt transformations
> of xml docs to html viewable?  if so, how in the hizzeck would
> i work this snippet? im stuck, and cant find any info on this...
> 
> must be basic, but im soo far on this project, i dont want
> this to be a problem ;) thanks (column values transformed into
> dry late night humor to protect against any nda issues.)
> 
> <row num="1">
> 
>       <column num="1">Charlie</column>
> 
>       <column num="2">Horse</column>
> 
>       <column num="3">10</column>
> 
>       <column num="4">Richter Scale</column>
> 
> </row>
> 
> and i want this to show up in a table row, 4 columns.  there are
> more instances of "row" nodes, so this has to repeat.....
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to