nested if enhancement?

Stephen (archive)

Usenet Archive
Joined
Jun 9, 2000
Messages
250
Reaction score
0
I want to retrieve the name attribute from each of the entrydata elements in the very first viewentry element to create table headings. My XSL works by looping through all the elements and checking if it is the first element. Then grab the name attribute from each of the entrydata elements for the column title. The table must be created dynamically since this XSL format will be applied to different XML data. I think there is probably a more efficient method than the nested if statements. Perhaps a "getFirst" or something? Would someone suggest an improvement?

My XML:
<viewentries toplevelentries="46">
<viewentry position="1">
<entrydata columnnumber="0" name="Customer Name">
<text>Pickett, Simona</text>
</entrydata>
<entrydata columnnumber="2" name="Phase">
<text>Port Review</text>
</entrydata>
</viewentry>
</viewentries>

My XSL:
<xsl:for-each select="viewentries/viewentry">
<xsl:if test="position=1">
<xsl:for-each select="entrydata">
<th><xsl:value-of select="@name"/></th>
</xsl:for-each>
</xsl:if>
</xsl:for-each>

Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,799
Members
249,594
Latest member
henrywalsh

Latest Threads

Top