SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2003
    Location
    Halifax
    Posts
    191
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Not a valid XSLT function?

    I am currently trying to create a dynamically driven navigation system using server side XML.

    This is my first attempt at something like this, so I apologise if this is a fairly basic question.

    When trying to run the XML from the server, I loose all my CSS formatting. Initially I thought this was because I had changed the stylesheet reference from:

    <xsl:stylesheet xmlnssl="http://www.w3.org/TR/WD-xsl">

    to

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

    However upon opening the XML file with the above stylesheet reference I get the following error:

    Code:
    'context' is not a valid XSLT or XPath function. -->context()<--[not(end())]
    Can anyone advise me how I would get around this?

    Here is the full xsl code:
    Code:
    <?xml version="1.0" ?> 
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
    
    	<xsl:template match="/"> 
    	
    	<!-- BUILD MENU BAR -->
    	  <DIV ID="divMenuBar">
    	  <TABLE ID="tblMenuBar" BORDER="0">
    	  <TR>
    	  <xsl:for-each select="//TOPICS[TOPIC]">
    		<TD CLASS="clsMenuBarItem">
    		  <xsl:attribute name="ID">
    			tdMenuBarItem<xsl:value-of select="@TYPE" />
    		  </xsl:attribute>
    		  <xsl:value-of select="@TYPE" />
    		</TD>
    		<xsl:if test="context()[not(end())]">
    		  <TD>|</TD>
    		</xsl:if>
    	  </xsl:for-each>
    	  </TR>
    	  </TABLE>
    	  </DIV>
    	
    	  <!-- BUILD INDIVIDUAL MENUS -->
    
    	  <xsl:for-each select="//TOPICS[TOPIC]">
    		<DIV CLASS="clsMenu">
    		<xsl:attribute name="ID">
    		  divMenu<xsl:value-of select="@TYPE" />
    		</xsl:attribute>
    		  <DIV CLASS="clsMenuSpacer"></DIV>
    		  <xsl:for-each select="TOPIC">
    		  <DIV>
    		  <A>
    			<xsl:attribute name="HREF">
    			  http://msdn.microsoft.com<xsl:value-of select="URL" />
    			</xsl:attribute>
    			<xsl:value-of select="TITLE" />
    		  </A>
    		  </DIV>
    		  </xsl:for-each>
    		</DIV>
    	  </xsl:for-each>
    	
    	</xsl:template>
    	
    	</xsl:stylesheet>

  2. #2
    SitePoint Wizard
    Join Date
    Jan 2001
    Location
    Milton Keynes, UK
    Posts
    1,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My knowledge of XSL is a bit sketchy but I don't think either the context() and end() functions are standard functions.

    Try either of the following and see how you go.

    Code:
    <xsl:if test=".[not(last())]">
    	<TD>|</TD>
    </xsl:if>
    Code:
    <xsl:if test=".[position() != last()]">
    	<TD>|</TD>
    </xsl:if>

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2003
    Location
    Halifax
    Posts
    191
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for that Shane


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •