XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Mo FishSubject: 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?

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" omit-xml-declaration="yes" />

<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>

Postnext
Ivan PedruzziSubject: XSL Help Please.
Author: Ivan Pedruzzi
Date: 03 Nov 2006 03:11 PM
Hi Mo,

Which Stylus Studio version are you running?

Ivan Pedruzzi
Stylus Studio Team

Postnext
Mo FishSubject: 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.

Postnext
Ivan PedruzziSubject: XSL Help Please.
Author: Ivan Pedruzzi
Date: 03 Nov 2006 04:02 PM
Sorry,

This forum is for Stylus Studio users only.

If you are re-considering your XML tools choice please visit
http://www.stylusstudio.com/xml_download.html


Ivan Pedruzzi
Stylus Studio Team

Postnext
Mo FishSubject: 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.

Postnext
Ivan PedruzziSubject: XSL Help Please.
Author: Ivan Pedruzzi
Date: 03 Nov 2006 04:18 PM

Could you please post an example of input document you would like to process?

Ivan Pedruzzi
Stylus Studio Team

Postnext
Mo FishSubject: 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>

<male status="eventopen">
<competitor>
<competitorname>Person1</competitorname>
<competitorcountry>Person1</competitorcountry>
</competitor>
<competitor>
<competitorname>Person2</competitorname>
<competitorcountry>Person2</competitorcountry>
</competitor>
<competitor>
<competitorname>Person3</competitorname>
<competitorcountry>Person3</competitorcountry>
</competitor>
</male>

<male status="eventclosed">
<gold>
<competitorname>Mrs Gold</competitorname>
<competitorcountry>Mrs Gold</competitorcountry>
<competitorfinaltime>Mrs Gold</competitorfinaltime>
</gold>
<silver>
<competitorname>Mrs Silver</competitorname>
<competitorcountry>Mrs Silver</competitorcountry>
<competitorfinaltime>Mrs Silver</competitorfinaltime>
</silver>
<bronze>
<competitorname>Mrs Bronze</competitorname>
<competitorcountry>Mrs Bronze</competitorcountry>
<competitorfinaltime>Mrs Bronze</competitorfinaltime>
</bronze>
</male>

</eventid>
</mofish>

this is the kind of display i'm looking to achieve

http://geocities.com/yug_08/VB/ (coded in html)

Postnext
Ivan PedruzziSubject: XSL Help Please.
Author: Ivan Pedruzzi
Date: 03 Nov 2006 05:23 PM
See attached solution, It was easy to design using Stylus Studio XML Publisher, I suggest to download enterprise edition and give it a try


Ivan Pedruzzi
Stylus Studio Team


Documentcoldfusion1.xsl

Postnext
Mo FishSubject: 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.

Mo

Postnext
Mo FishSubject: 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.

<xsl:choose>
<xsl:when match="male/@status = 'eventopen'">
<div class="open">Open</div>
</xsl:when>

<xsl:otherwise>

<xsl:when match="male/@status = 'eventclosed'">
<div class="closed">Closed</div>
</xsl:when>

</xsl:otherwise>
</xsl:choose>

Posttop
Tony LavinioSubject: XSL Help Please.
Author: Tony Lavinio
Date: 06 Nov 2006 09:23 AM
Yes.

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.