[xsl] An XSL:Choose Issue.

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

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