selecting a single of a node

admin

Administrator
Staff member
Hi -The column headings should be created dynamically so that any xml file canbe used with the one xsl file. Below is what I have so far. What I want toknow is how to select just a single node of a given name that might occurmore than one within the xml tree. What is below almost does it, however, Ican't seem to make it select just the first node in the list of matchingnodes ... I hope that someone can help.What I have ...<table border="1" cellpadding="0" cellspacing="0"><tr><xsl:for-eachselect="//ListOfOpportunity_Industry/child::Opportunity_Industry"><xsl:value-of select="name()"/></xsl:for-each></tr><xsl:apply-templates select="//Opportunity_Industry"/></table></body></html></xsl:template><xsl:template match="Opportunity_Industry"><tr><xsl:for-each select="*"><td><xsl:value-of select="text()"/></td></xsl:for-each></tr></xsl:template></xsl:stylesheet>The data that is bieng used is below this.<ListOfOpportunity_Industry><Opportunity_Industry><Industry>computer & software stores</Industry><SICCode>5734</SICCode></Opportunity_Industry><Opportunity_Industry><Industry>computer maintenance & repair</Industry><SICCode>7378</SICCode></Opportunity_Industry><Opportunity_Industry><Industry>computer peripheral equipment</Industry><SICCode>3577</SICCode></Opportunity_Industry><Opportunity_Industry><Industry>computer related services</Industry><SICCode>7379</SICCode></Opportunity_Industry><Opportunity_Industry><Industry>computer rental & leasing</Industry><SICCode>7377</SICCode></Opportunity_Industry><Opportunity_Industry><Industry>computer storage devices</Industry><SICCode>3572</SICCode></Opportunity_Industry><Opportunity_Industry><Industry>computer terminals</Industry><SICCode>3575</SICCode></Opportunity_Industry><Opportunity_Industry><Industry>computers, peripherals & software</Industry><SICCode>5045</SICCode></Opportunity_Industry><Opportunity_Industry><Industry>electronic computers</Industry><SICCode>3571</SICCode></Opportunity_Industry></ListOfOpportunity_Industry>
 
Back
Top