MaKSiNG
Technical User
- Dec 4, 2003
- 19
I have an XML file as follows:
<record>
<item name="linksheading">
<value>Design</value>
</item>
<item name="linkspara">
<value>Design Consultancy</value>
</item>
<item name="r_links">
<value>
<item name="c_link">
<value>
<item name="link_linktext">
<value>Details</value>
</item>
</value>
</item>
</value>
</item>
</record>
Via an XSL I hope to achieve a HTML output which prints a table with the 3 value in different table rows beneath each other. Eg:
Design
Design Consultancy
Details
I have the start of the XSL which follows but am struggling to reference the value of the "@name='link_linktext'" (Details) after having iterated through "@name='linksheading'" and "@name='linkspara'" since this is a child node 4 levels down from the context I am in currently.
<table>
<xsl:for-each select="record/item">
<tr>
<xsl:choose>
<xsl:when test="@name='linksheading'">
<td>
<xsl:value-of select="value" />
</td>
</xsl:when>
</xsl:choose>
</tr>
<tr>
<xsl:choose>
<xsl:when test="@name='linkspara'">
<td>
<xsl:value-of select="value" />
</td>
</xsl:when>
</xsl:choose>
</tr>
<tr>
<xsl:choose>
<xsl:when test="@name='link_linktext'">
<td>
<xsl:value-of select="value" />
</td>
</xsl:when>
</xsl:choose>
</tr>
The bolded 'when test' obviously looks for the @name in the wrong context and I have tried inserting a new 'for-each' select for this <tr> but that causes this @name to be printed after the first 2 test have iterated through all of their satisfying nodes.
Please help,
Thx,
MaKS
<record>
<item name="linksheading">
<value>Design</value>
</item>
<item name="linkspara">
<value>Design Consultancy</value>
</item>
<item name="r_links">
<value>
<item name="c_link">
<value>
<item name="link_linktext">
<value>Details</value>
</item>
</value>
</item>
</value>
</item>
</record>
Via an XSL I hope to achieve a HTML output which prints a table with the 3 value in different table rows beneath each other. Eg:
Design
Design Consultancy
Details
I have the start of the XSL which follows but am struggling to reference the value of the "@name='link_linktext'" (Details) after having iterated through "@name='linksheading'" and "@name='linkspara'" since this is a child node 4 levels down from the context I am in currently.
<table>
<xsl:for-each select="record/item">
<tr>
<xsl:choose>
<xsl:when test="@name='linksheading'">
<td>
<xsl:value-of select="value" />
</td>
</xsl:when>
</xsl:choose>
</tr>
<tr>
<xsl:choose>
<xsl:when test="@name='linkspara'">
<td>
<xsl:value-of select="value" />
</td>
</xsl:when>
</xsl:choose>
</tr>
<tr>
<xsl:choose>
<xsl:when test="@name='link_linktext'">
<td>
<xsl:value-of select="value" />
</td>
</xsl:when>
</xsl:choose>
</tr>
The bolded 'when test' obviously looks for the @name in the wrong context and I have tried inserting a new 'for-each' select for this <tr> but that causes this @name to be printed after the first 2 test have iterated through all of their satisfying nodes.
Please help,
Thx,
MaKS