Thanks Michael and Brad,
Your help and insight is greatly appreciated.
Marijan Madunic
Quoting Michael Kay <mike(_at_)saxonica(_dot_)com>:
Yes, you can do
<xsl:if test="position()=1">
<firstname><xsl:value-of select="."/></firstname>
</xsl:if>
Alternatively,
<xsl:variable name="t" select="tokenize(...)"/>
<first><xsl:value-of select="$t[1]"/></first>
<xsl:for-each select="2 to count($t)-1">
<middle><xsl:value-of select="subsequence($t, ., 1)"/></middle>
</xsl:for-each>
<last><xsl:value-of select="$t[last()]"/></last>
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: hajduk(_at_)imag(_dot_)net [mailto:hajduk(_at_)imag(_dot_)net]
Sent: 01 June 2007 15:21
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] tokenize() a string and then create a node-set
Haven't used the tokenize() function and just wanted a bit of insight.
Note, could create a called-template plus a user defined
function(s) to do the following but want to see if there is
an easier/other way to do it.
I want to take a string containing a person's name and break
it apart based on a space. Then parse the result as follows.
If position is first then <firstname>, if position is last
then <lastname> else <midname>.
Can this be done using a <for-each select="tokenize($string,
' ')"> with a <choose>|<if> statement inside?
Any ideas will be greatly appreciated.
Marijan Madunic
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--