Subject:XSL Help Please. Author:Mo Fish Date:03 Nov 2006 03:47 PM Originally Posted: 03 Nov 2006 12:27 PM
Hello. I'm currently trying to produce a cold fusion page using XSL to position my information, however am running into a few problems when displaying this information in my table. It is currently not displaying my table at all and I don't quite understand why. If anyone can see a problem with my XSL document can you please reply. Can I use multiple uses of templates throughout my document?
<xsl:template match="/"> <!-- open template -->
<xsl:element name="html"> <!-- open html -->
<xsl:element name="head"> <!-- open head -->
<link rel="STYLESHEET" type="text/css" href="are2007.css"/> <!-- link to stylesheet -->
<title>Boo Hoo</title> <!-- page title -->
</xsl:element> <!-- close head -->
<xsl:element name="body"> <!-- open body -->
<xsl:text>Events Avaliable ..</xsl:text>
<xsl:element name="br" /> <!-- open br -->
<xsl:element name="br" /> <!-- open br -->
<xsl:apply-templates select="/are2007/eventid" />
</xsl:element> <!-- close br -->
</xsl:element> <!-- close br -->
</xsl:template> <!-- close template-->
<xsl:template match="eventid"> <!-- open template -->
<img src="images/arrow.gif"/>
<xsl:element name="a"> <!-- open a tag -->
<xsl:value-of select="eventname"/>
</xsl:element> <!-- close a tag -->
</xsl:template> <!-- close template -->
<xsl:template match="male"> <!-- open template -->
<xsl:element name="table"> <!-- open table -->
<xsl:element name="tr"> <!-- open tr -->
<xsl:element name="td"> <!-- open td -->
<xsl:element name="a">
<xsl:attribute name="href">displayevents.cfm?id=<xsl:value-of select="@id"/></xsl:attribute>
<xsl:text>Male</xsl:text>
</xsl:element> <!-- close a -->
</xsl:element> <!-- close td -->
<xsl:element name="td"> <!-- open td -->
<xsl:if test="@status = 'eventopen'">
<xsl:element name="span"> <!-- open span -->
<xsl:attribute name="class">View Event Details</xsl:attribute>
<xsl:value-of select="."/>
</xsl:element> <!-- close span -->
</xsl:if>
</xsl:element> <!-- close td -->
</xsl:element> <!-- close tr-->
<xsl:element name="tr"> <!-- open tr -->
<xsl:element name="td"> <!-- open td -->
<xsl:element name="a"> <!-- open a tag -->
<xsl:attribute name="href">displayevents.cfm?id=<xsl:value-of select="@id"/></xsl:attribute>
<xsl:text>Female</xsl:text>
</xsl:element> <!-- close a tag -->
</xsl:element> <!-- close td tag -->
<xsl:element name="td"> <!-- open td -->
<xsl:text>Open</xsl:text>
</xsl:element> <!-- close td -->
</xsl:element> <!-- close tr -->
</xsl:element> <!-- close table -->
</xsl:template>
</xsl:stylesheet>
Subject:XSL Help Please. Author:Mo Fish Date:03 Nov 2006 04:02 PM Originally Posted: 03 Nov 2006 03:55 PM
hello there, I'm currently running a WAMPS web-server and using XML Spy to debug and compile my XML and XSL files. What will stylus allow me to do differently? I found this place hoping I could speak to someone with a little bit of XSL knowledge as I am totally stumped.
Subject:XSL Help Please. Author:Mo Fish Date:03 Nov 2006 04:14 PM Originally Posted: 03 Nov 2006 04:13 PM
I have downloaded and installed stylus home edition 2007 and am using my trial period to see how i go using this software. looks good to start with, i like the whole preview idea, without flicking back and forward to IE. in my preview panel i see my page displayed, however the table is still not present. don't have a clue why its not working. its something with my 3rd template. it doesn't seem to recognize it at all.
Subject:XSL Help Please. Author:Mo Fish Date:03 Nov 2006 04:33 PM Originally Posted: 03 Nov 2006 04:22 PM
here is my XML document. It will contain many events, however i'm sure you are only concerned in one, as the rest look similar.
<?xml version="1.0"?>
<mofish>
<eventid id="1">
<eventname>Downhill</eventname>
<eventdescription>Description here for downhill</eventdescription>
<eventlocation>Sweden</eventlocation>
<eventtime>10pm</eventtime>
Subject:XSL Help Please. Author:Mo Fish Date:03 Nov 2006 05:44 PM Originally Posted: 03 Nov 2006 05:43 PM
thanks ever so much, I see how this works and where i have went wrong. I have always been taught not to use CSS inside the actual XSL file and always to link to an external style sheet using class's. I will now attempt to go through this working example and link to my seperate CSS document.
thanks again for all your help. I will try that as you suggest, as I have another page to construct which will be similar.
Subject:XSL Help Please. Author:Mo Fish Date:04 Nov 2006 07:31 AM
hello again. just a quick question regarding choose statements, as i cant seem to find the equivalent to an "else if" in XSL. what i'm trying to say is.. if the gate it open display in green, else display in red. however getting that to work is proving a problem. do i have the right idea behind this using choose the statement.