[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Not able to work further with templates...match..

Subject: Re: Not able to work further with templates...match..
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Sat, 23 Dec 2000 20:10:02 +0000
able to work further
Sachi,

> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transforml"
>                 version="1.0"
>                 xmlns:msxsl="urn:schemas-microsoft-com:xslt"
>                 xmlns:user="http://mycompany.com/mynamespace">

The XSLT namespace needs to be 'http://www.w3.org/1999/XSL/Transform'
- there's no 'l' at the end.

You also have problems in the stylesheet because you have result
elements outside the xsl:templates that you're defining.  Putting this
right makes your stylesheet look something like:

<xsl:template match="/">
  <HTML>
    <HEAD>
      <TITLE>menu</TITLE>
      <LINK rel="stylesheet" type="text/css" href="DIMStyle.css"/>
    </HEAD>
    <body class="MenuBody">
      <div CLASS="inner" STYLE="width:100%; height:100%;">
        <div CLASS="theMenu" ID="theMenu">
          <h1><xsl:value-of select="//topFolderOut/test"/></h1>
          <xsl:apply-templates />
        </div>
      </div>
      <div ID="theMenuUp" CLASS="scrollButtonOut"
           TITLE="Click to move the menu down">
        <img SRC="/images/menuUp.gif"/>
      </div>
      <div ID="theMenuDown" CLASS="scrollButtonOut"
           TITLE="Click to move the menu up">
        <img SRC="/images/menuDown.gif"/>
      </div>
    </body>
  </HTML>
</xsl:template>

<xsl:template match="topFolderOut">
  <div CLASS="topFolderOut" TARGET="right">
    <xsl:attribute name="ID"><xsl:value-of select="@ID"/></xsl:attribute>
    <xsl:attribute name="HREF"><xsl:value-of select="@URL"/></xsl:attribute>
    <xsl:attribute name="TITLE"><xsl:value-of select="@Title"/></xsl:attribute>
  </div>
</xsl:template>

[This second template could also look like:

<xsl:template match="topFolderOut">
  <div CLASS="topFolderOut" TARGET="right"
       ID="{@ID}" HREF="{@URL}" TITLE="{@Title}" />
</xsl:template>

with the same effect.]

I doubt this will give you the results that you're after, however.
In the root-matching template (the first one above), you have an h1
heading with a content being the value of the first 'test' element
under a 'topFolderOut' element.  It doesn't look like you have a
'test' element under a 'topFolderOut' element in your source XML, so
no content will be given.  Another problem is that none of the content
of the 'topFolderOut' elements will be processed because the
topFolderOut-matching template (the second one above) doesn't put any
content within the 'div'.  You probably want to have
xsl:apply-templates in there somewhere.

Nevertheless, the main problems were the XSLT namespace and the
general structure of the stylesheet, so hopefully the small problems
mentioned above will be relatively easy to fix.

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.