<xsl:variable name="myvar" select="substring(@foo,0,2)
XPath is 1-based. Therefore, the expression to produce the substring,
consisting of the first two characters in the string value of @foo is:
substring(@foo, 1, 2)
Cheers,
Dimitre Novatchev
"Joseph Kesselman" <keshlam-nospam@comcast.netwrote in message
news:45196e65$1@kcnews01...
requeth@gmail.com wrote:
>variable. How would I do this? I know how to create the variable, but
>I'm not sure how to take just the first two characters of the string.
>
XSLT and XPath come with a function library that includes the traditional
substring function. Just set the variable to an XPath expression that
invokes it. For example, if you want the truncated value of the current
node's foo attribute, you could write
>
<xsl:variable name="myvar" select="substring(@foo,0,2)
>
>
http://www.w3.org/TR/1999/REC-xpath-...ring-Functions
(though it looks like there's a typo in one of the examples).
>
>
>
--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden