I am trying to figure out how to search for the 2nd instance
of a character in a string and then output only the first 4
digits that follow this character. For the PubDate element, I
want to find the 2nd instance of the back slash ("/") and
then output the 4-digit year that follows this back slash.
Actually that's a forwards slash.
In
the following example, I want to output "2008'.
<PubDate>5/12/2008 3:13:14 PM</PubDate>
In XSLT 2.0
replace(PubDate, '^[0-9]*/[0-9]*/([0-9]*).*$', $1)
In XSLT 1.0 (or 2.0)
substring(substring-after(substring-after(PubDate, '/'), '/'), 1, 4)
Michael Kay
http://www.saxonica.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>
--~--