xsl-list
[Top] [All Lists]

[xsl] using tokenize() and referencing parent elements

2007-05-10 09:52:37
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[(_at_)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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--