Hi all!

Im creating a simple menu, the xml code is:


<?xml version="1.0" encoding="ISO-8859-1"?>

<topFrame id="top">
        <topMenu>
           <menuItem id="m1_services_" capt="services" href="/info/services.xml">
              <desc>Description of the Guanoco.com services.</desc>
           </menuItem>
           <menuItem id="m1_aboutus_" capt="about us" href="/info/about_us.xml">
              <desc>Who we are.</desc>
           </menuItem>
           <menuItem id="m1_profile_" capt="profile" href="/users/profile.xml">
              <desc>Registered users can review and update their personal data.</desc>
           </menuItem>
                 <menuItem id="m1_sitemap_" capt="site map" href="/info/sitemap.xml">
                    <desc>All the site's pages and their functions.</desc>
           </menuItem>
           <menuItem id="m1_job_" capt="job opportunities" 
href="/info/job_oportunities.xml">
              <desc>Job opportunities with &amp; at Guanoco.com.</desc>
           </menuItem>
        </topMenu>
</topFrame>


and the xsl is:


<?xml version="1.0"?>

<xsl:stylesheet
   version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template match="/">
   <html>
      <head>
         <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
         <script src="js/utils.js"/>
      </head>
      <body bgcolor="#FFFFFF">
         <xsl:apply-templates/>
      </body>
   </html>
</xsl:template>

<xsl:template match="topMenu">
  <table width="750" border="0" cellspacing="0" cellpadding="0" bgcolor="#336666" 
height="15">
      <tr>
        <td valign="top" width="220">
           <img src="images/transp.gif" width="220" height="5"/>
        </td>
        <xsl:apply-templates/>
        <td valign="top" width="50">
           <img src="images/transp.gif" width="50" height="5"/>
        </td>
      </tr>
   </table>
</xsl:template>

<xsl:template match="menuItem">
   <xsl:variable name="widthList">095 080 090 080 135</xsl:variable>
   <xsl:variable name="width"><xsl:value-of select="substring($widthList, 
4*(position()-1)+1, 3)"/></xsl:variable>
   <xsl:variable name="height">15</xsl:variable>
   <td valign="top" width="{$width}" height="{$height}">
      <a>
         <xsl:attribute name="onmouseover">javascript:rollover('<xsl:value-of 
select="@id"/>','on');</xsl:attribute>
         <xsl:attribute name="onmouseout">javascript:rollover('<xsl:value-of 
select="@id"/>','off');</xsl:attribute>
         <xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute>
         <img width="{$width}" height="{$height}" border="0">
            <xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute>
            <xsl:attribute name="src">images/<xsl:value-of 
select="@id"/>off.gif</xsl:attribute>
            <xsl:attribute name="alt"><xsl:value-of select="@capt"/></xsl:attribute>
         </img>
      </a>
      <xsl:value-of select="position()"/>
   </td>
</xsl:template>

</xsl:stylesheet>


The values returned by the XPath "position()" function are 2, 4, 6, 8, 10!!!!!! so the 
"substring" function fails to compute 
the bitmap width for each link and the menu presentation is damaged :-(

What is the problem here? is this the mail list for this question?

Regards, 
Eduardo Yanez.

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to