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

An XSL:Choose Issue.

Subject: An XSL:Choose Issue.
From: Ben Trafford <ben@xxxxxxxxxxxxx>
Date: Mon, 05 May 2003 19:07:43 -0400
byjos

Hi!


I'm having an XSLT issue with getting xsl:choose to work in the way I want it to. Any help would be appreciated.

I have this XML fragment:

<entry date.entered="05.02.2003" id="1.004" type="episode">
<episode date.aired="04.18.2000" id="reprimands" season="1">Reprimands (Episode #01-004)</episode>
<body>
<paragraph>Aired on 4/18/00, Stardate Unknown. Written and Directed by Starfleet. A discussion between Chief of Operations, Lieutenant Nevok, and Ensign Tyler near the Artifact is witnessed. A strange occurrence causes an equipment malfunction in Science Lab Two, but no explanation is obvious. Lieutenant Nevok is commanded to investigate.
<entry.link to.entry="artifact">Artifact</entry.link><entry.link to.entry="balin.tarsis">Balin, Tarsis</entry.link><entry.link to.entry="byjos.chief">Byjos, Chief</entry.link><entry.link to.entry="nevok">Nevok</entry.link><entry.link to.entry="stone.damien">Stone, Damien</entry.link><entry.link to.entry="tyler.wendy">Tyler, Wendy</entry.link>
</paragraph>
</body>
</entry>


I run it through this XSL fragment:

	<xsl:template match="entry.link">
		<xsl:choose>
			<xsl:when test="position() = 1">
				SEE ALSO: <i><a href="#{@to.entry}"><xsl:apply-templates/></a>; </i>
			</xsl:when>
			<xsl:when test="position() = last">
				<i><a href="#{@to.entry}"><xsl:apply-templates/></a>.</i>	
			</xsl:when>
			<xsl:when test="(not(position() = 1)) or (not(position() = last))" >
				<i><a href="#{@to.entry}"><xsl:apply-templates/></a>; </i>
			</xsl:when>	
		</xsl:choose>	
	</xsl:template>

What I'm getting is this:

<a name="1.004"></a>
	<b>Reprimands (Episode #01-004)</b>


<p>Aired on 4/18/00, Stardate Unknown. Written and Directed by Starfleet. A discussion between Chief of Operations, Lieutenant Nevok, and Ensign Tyler near the Artifact is witnessed. A strange occurrence causes an equipment malfunction in Science Lab Two, but no explanation is obvious. Lieutenant Nevok is commanded to investigate.


<i><a href="#artifact">Artifact</a>; </i><i><a href="#balin.tarsis">Balin, Tarsis</a>; </i><i><a href="#byjos.chief">Byjos, Chief</a>; </i><i><a href="#nevok">Nevok</a>; </i><i><a href="#stone.damien">Stone, Damien</a>; </i><i><a href="#tyler.wendy">Tyler, Wendy</a>; </i>

</p>

What I -want- is this:

<a name="1.004"></a>
	<b>Reprimands (Episode #01-004)</b>


<p>Aired on 4/18/00, Stardate Unknown. Written and Directed by Starfleet. A discussion between Chief of Operations, Lieutenant Nevok, and Ensign Tyler near the Artifact is witnessed. A strange occurrence causes an equipment malfunction in Science Lab Two, but no explanation is obvious. Lieutenant Nevok is commanded to investigate.


SEE ALSO: <i><a href="#artifact">Artifact</a>; </i><i><a href="#balin.tarsis">Balin, Tarsis</a>; </i><i><a href="#byjos.chief">Byjos, Chief</a>; </i><i><a href="#nevok">Nevok</a>; </i><i><a href="#stone.damien">Stone, Damien</a>; </i><i><a href="#tyler.wendy">Tyler, Wendy</a>. </i>

</p>

Thanks in advance!

--->Ben


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.