Mecha-Knuckles Posted October 2, 2005 Share Posted October 2, 2005 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 More sharing options...
carychow Posted October 3, 2005 Share Posted October 3, 2005 humm...I think you need to use this element: "<xsl:attribute>".The code should be like this <a><xsl:attribute name="href"><xsl:value-of select="./site/"/></xsl:attribute><xsl:value-of select="./name"/></a> More details in W3Schools: The <xsl:attribute> Element Link to comment Share on other sites More sharing options...
Mecha-Knuckles Posted October 5, 2005 Author Share Posted October 5, 2005 I tried it, yet it displays the same. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now