[xsl] using tokenize() and referencing parent elements

Subject: [xsl] using tokenize() and referencing parent elements
From: "Spencer Tickner" <spencertickner@xxxxxxxxx>
Date: Thu, 10 May 2007 09:52:20 -0700
Hi list, thanks in advance for any help.

I'm using tokenize() but have to get the parent of the string token to
determine if the string is one thing, or another. I came across a
similiar post on the list.. but I can't seem to get it working with my
case:

XML

<PS Class="SummaryKeyWords">
					<em>Local Governments Statutes Amendment Act</em>; <em>Municipal
Act; Fish Protection Act</em>Bill 25; riparian; endangered</PS>

XSL (not quite working)

<xsl:template match="PS[@Class = 'SummaryKeyWords']">
	<xsl:variable name="me" select="."/>
	<keywords>
		 <xsl:for-each select="tokenize(., ',|;')">
		 	<xsl:choose>
				<xsl:when test="$me[current() eq text()/parent::em]">
					<keyword><actname><xsl:value-of
select="normalize-space(.)"/></actname></keyword>
				</xsl:when>
				<xsl:otherwise>
		 			<keyword><xsl:value-of select="normalize-space(.)"/></keyword>
				</xsl:otherwise>
			</xsl:choose>
		 </xsl:for-each>
	</keywords>
</xsl:template>

XML output wanted:

<keywords>
 <keyword><actname>Local Governments Statutes Amendment Act</actname></keyword>
 <keyword><actname>Municipal Act</actname></keyword>
 <keyword><actname>Fish Protection Act Bill 25</actname></keyword>
 <keyword>riparian</keyword>
 <keyword>endangered</keyword>
</keywords>

XML Output I'm getting:

<keywords>
 <keyword>Local Governments Statutes Amendment Act</keyword>
 <keyword>Municipal Act</keyword>
 <keyword>Fish Protection Act Bill 25</keyword>
 <keyword>riparian</keyword>
 <keyword>endangered</keyword>
</keywords>


Much thanks,


Spencer

Current Thread