[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Substrings
On 5/31/05, Karl Stubsjoen <kstubs@xxxxxxxxx> wrote: > To "tokenize" is that to say I am going to split the string up by > spaces, or other delimiters? So then, I could recursively call a > template which returns a value of nothing but passes back the > substring value of supplied string after each space until which time I > find an @ at this point I stop recursing and pass back the value. (i > think that makes sense, and I think I can write that!) > > I am using XSLT 1 with microsoft's msxml parser so exslt is not available to me. Using FXSL (for MSXML), one would write something like this: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:vendor="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="vendor" > <xsl:import href="strSplit-to-Words.xsl"/> <!-- To be applied on: testSplitToWords10.xml --> <xsl:output omit-xml-declaration="yes" /> <xsl:template match="/"> <xsl:variable name="vrtfWords"> <xsl:call-template name="str-split-to-words"> <xsl:with-param name="pStr" select="/*"/> <xsl:with-param name="pDelimiters" select="' ,.;	 '"/> </xsl:call-template> </xsl:variable> <xsl:copy-of select= "vendor:node-set($vrtfWords)/word [contains(., '@')]"/> </xsl:template> </xsl:stylesheet> When this transformation is applied on this source.xml: <t> Mr. Joseph Smith Jr. III jsmithjr@xxxxxxxx "J Jr." </t> the wanted result is produced: <word>jsmithjr@juno</word> Hope this helped. Cheers, Dimitre Novatchev
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|