1<?xml version="1.0"?> 2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" 3 xmlns:xalan="http://xml.apache.org/xalan" 4 exclude-result-prefixes="xalan"> 5<!-- Indent just for readability --> 6<xsl:output indent="yes"/> 7 8 <!-- FileName: libraryTokenize01.xsl --> 9 <!-- Document: http://www.w3.org/TR/xslt --> 10 <!-- DocVersion: 19991116 --> 11 <!-- Creator: Shane Curcuru --> 12 <!-- Purpose: Basic test of tokenize() extension function --> 13 14<xsl:template match="/"> 15 <out> 16 <!-- Using copy-of then value-of on the same select= shows that 17 it's properly returning a node-set each time. 18 copy-of will print out all the nodes' text values in the set 19 value-of will only print the first nodes' text value 20 --> 21 <test desc="simple string, default separators"> 22 <xsl:copy-of select="xalan:tokenize('one two	three')"/> 23 <xsl:text>, </xsl:text> 24 <xsl:value-of select="xalan:tokenize('one two	three')"/> 25 </test> 26 <test desc="simple string, colon separator"> 27 <xsl:copy-of select="xalan:tokenize('one two:three', ':')"/> 28 <xsl:text>, </xsl:text> 29 <xsl:value-of select="xalan:tokenize('one two:three', ':')"/> 30 </test> 31 <test desc="blank string, default separators"> 32 <xsl:copy-of select="xalan:tokenize('')"/> 33 <xsl:text>, </xsl:text> 34 <xsl:value-of select="xalan:tokenize('')"/> 35 </test> 36 <test desc="blank string, blank separators"> 37 <xsl:copy-of select="xalan:tokenize('', '')"/> 38 <xsl:text>, </xsl:text> 39 <xsl:value-of select="xalan:tokenize('', '')"/> 40 </test> 41 <test desc="blank string, colon, x are separators"> 42 <xsl:copy-of select="xalan:tokenize('', ':x')"/> 43 <xsl:text>, </xsl:text> 44 <xsl:value-of select="xalan:tokenize('', ':x')"/> 45 </test> 46 <test desc="all delimiter string, default separators"> 47 <xsl:copy-of select="xalan:tokenize(' 	 48')"/> 49 <xsl:text>, </xsl:text> 50 <xsl:value-of select="xalan:tokenize(' 	 51')"/> 52 </test> 53 <test desc="all delimiter string, colon, x are separators"> 54 <xsl:copy-of select="xalan:tokenize(':x::xx:', ':x')"/> 55 <xsl:text>, </xsl:text> 56 <xsl:value-of select="xalan:tokenize(':x::xx:', ':x')"/> 57 </test> 58 <!-- Note: null string xalan:tokenize() is not a legal extension call --> 59 </out> 60</xsl:template> 61 62 63 <!-- 64 * Licensed to the Apache Software Foundation (ASF) under one 65 * or more contributor license agreements. See the NOTICE file 66 * distributed with this work for additional information 67 * regarding copyright ownership. The ASF licenses this file 68 * to you under the Apache License, Version 2.0 (the "License"); 69 * you may not use this file except in compliance with the License. 70 * You may obtain a copy of the License at 71 * 72 * http://www.apache.org/licenses/LICENSE-2.0 73 * 74 * Unless required by applicable law or agreed to in writing, software 75 * distributed under the License is distributed on an "AS IS" BASIS, 76 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 77 * See the License for the specific language governing permissions and 78 * limitations under the License. 79 --> 80 81</xsl:stylesheet> 82