xsl-list
[Top] [All Lists]

getting inner elements from a nested for-each?

2003-01-29 17:23:44

 I'm trying to find the right XSLT to output dataSets
 into groups associated with a radio button for each
 set.
 So, I want to loop over each "dataSet"
 then loop over the sub-elements contained in there, 
 in my instance, <Image><Head><subhead>
 How do I get to Image, Head and subhead ?

 I've got the following on my XSL:
                                                        <xsl:variable 
name="dataSet"
select="dataSets/dataSet"/>
 <xsl:for-each select="$dataSet">
 <xsl:variable name="current" select="local-name()"/>
  <tr><td>
<input type="radio" name="dataSet"
value="{(_at_)dataSetName}"/>
  </td>
  <td>
    <xsl:value-of select="@dataSetName"/>
   </td>
   <td>
<xsl:variable name="innerElement"
select="$current/*"/>
<xsl:for-each select="$innerElement">
<xsl:value-of select="."/><BR/>
</xsl:for-each>
</td>
</tr>
</xsl:for-each>


And my XML:

 <dataSets>
  <dataSet

xmlns="http://ns.adobe.com/GenericCustomNamespace/1.0/";
 dataSetName="Data Set 1">
   <Image>file:one.jpg</Image>
   <Head><p>So many things</p></Head>
   <subhead><p>have to do with health</p></subhead>
  </dataSet>
  <dataSet

xmlns="http://ns.adobe.com/GenericCustomNamespace/1.0/";
 dataSetName="Data Set 2">
   <Image>file:two.jpg</Image>
   <Head><p>Alpha</p></Head>
   <subhead><p>Beta</p></subhead>
  </dataSet>
 </dataSets>


thoughts/help?

thanks,
Paul



__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>