S
Stephen
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.
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.