Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSL Transform formatting not showing up

Status
Not open for further replies.

jondoe0069

Programmer
Jul 16, 2007
19
US
I have an XSL transform style sheet that takes data from an xml file and transforms it into the formatting I set. This is used for a navigation menu that has sub-menu formatting for sub-menu items.

I'm trying to create an element to insert a space between the two sections of my menu, but some of my formatting isn't showing up on the page. The field in the table that pulls the data from the XML file shows up, but the formatting fields before it don't. Does anyone know why? This is the code for the stylesheet:

<xsl:stylesheet version="1.0" xmlns:xsl=" <xsl:template match="MenuItem">
<table cellpadding="0" cellspacing="0" border="0" width="180">
<tr bgcolor="#efefef">
<td colspan="3" height="1"><img src=" width="180" height="1" alt="" /></td>
</tr>
<tr bgcolor="#ce000c">
<td width="25" height="25"><img src=" width="25" height="25" alt="" /></td>
<td width="10" height="25"><img src=" width="10" height="25" alt="" /></td>
<td width="145" height="25"><a class="nav"><xsl:attribute name="href"><xsl:value-of select="MenuURL" /></xsl:attribute>
<xsl:value-of select="MenuName" /></a></td>
</tr>

<xsl:for-each select="SubMenuItems/SubMenuItem">
<tr bgcolor="#ce000c">
<td width="25" height="25"><img src=" width="25" height="25" alt="" /></td>
<td width="10" height="25"><img src=" width="10" height="25" alt="" /></td>
<td width="145" height="25"><a class="nav"><xsl:attribute name="href"><xsl:value-of select="SubMenuURL" /></xsl:attribute>
<xsl:value-of select="SubMenuName" /></a></td>
</tr></xsl:for-each>

<xsl:for-each select="Spacer">
<tr bgcolor="#efefef">
<td colspan="3" height="1"><img src=" width="180" height="10" alt="" /></td>
</tr>
<tr bgcolor="#ce000c"><td width="25" height="25"><img src=" width="25" height="25" alt="" /></td>
<td width="10" height="25"><img src=" width="10" height="25" alt="" /></td>
<td width="145" height="25"><xsl:value-of select="Spacer/SpacerItem"/></td></tr></xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
 
**The spacer element is the last one on the stylesheet. The "Spacer/SpacerItem" shows, but not the fields before it.
 
Note for the future: Please DO NOT start a new thread like this. Continue the old thread.

Now, having a look at your code:
Code:
<xsl:for-each select="[b][COLOR=green]Spacer[/color][/b]">
      <tr bgcolor="#efefef">
         <td colspan="3" height="1"><img src="[URL unfurl="true"]http://meekweb/images/meekwebLayout/spacer.gif"[/URL] width="180" height="10" alt="" /></td>
      </tr>
      <tr bgcolor="#ce000c"><td width="25" height="25"><img src="[URL unfurl="true"]http://meekweb/images/meekwebLayout/sideNav.gif"[/URL] width="25" height="25" alt="" /></td>
           <td width="10" height="25"><img src="[URL unfurl="true"]http://meekweb/images/meekwebLayout/spacer.gif"[/URL] width="10" height="25" alt="" /></td>
           <td width="145" height="25"><xsl:value-of select="[b][COLOR=green]Spacer/SpacerItem[/color][/b]"/></td></tr></xsl:for-each>

Without being able to see the input XML document, I would guess this is still incorrect, just as tsuji suggested in the older thread.

Your problem description is quite confusing, and since you do not provide an input document, nor what you expect as an output document, it is almost impossible to imagine what your situation is.

Help yourself by helping us...

Tom Morrison
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top