Jump to content

Displaying Lists in XSLT


Recommended Posts

I am trying to make a website in XML and display it with XSLT, yet I am experiencing trouble when I try to make a list. Here is the XML file:

<?xml version="1.0" encoding="ISO-8859-1"?><?xml-stylesheet href="site.xsl" type="text/xsl"?><page>  <title>Home</title>  <paragraph>Welcome to my (under consruction) tricking site! There will be forums up when I can get them installed, so keep posted.</paragraph>  <menu>    <item>      <link>        <site>http://www.something.com</site>        <name>Home</name>      </link>    </item>  </menu></page>

and the stylesheet:

<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform/"><xsl:template match="/">  <html>    <body>      <xsl:apply-templates select="page/menu"/>      <xsl:apply-templates select="page/title"/>      <xsl:apply-templates select="page/paragraph"/>    </body>  </html></xsl:template><xsl:template match="page/menu">  <ul>     <xsl:apply-templates/>  </ul></xsl:template><xsl:template match="page/menu/item"/>  <li>    <xsl:apply-templates/>  </li></xsl:template><xsl:template match="link">  <a href="<xsl:value-of select="./site/>"><xsl:value-of select="./name"/></a></xsl:template><xsl:template match="page/paragraph">  <p>    <xsl:value-of select="."/>  </p></xsl:template></xsl:stylesheet>

Everything except the list hyperlink works. It is displayed as, "www.something.com Home."

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...