Nic Miloslav Example 46 | KEYWORDS EXAMPLES AUTHORS |
---|
The starts-with function returns true if the first argument string starts with the second argument string, and otherwise returns false. The contains function returns true if the first argument string contains the second argument string, and otherwise returns false.
XML | HOME XSL 1 |
---|
<xslTutorial > |
<text>Welcome to XSL world.</text> |
<string>Welcome</string> |
<string>XSL</string> |
<string>XML</string> |
</xslTutorial> |
XSL 1 | HOME XML HTML 1 OUTPUT 1 |
---|
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' > |
<xsl:template match="/"> |
<TABLE border="1"> |
<TR> |
<TH colspan="3"> |
<xsl:value-of select="//text"/> |
</TH></TR> |
<TR><TH>string</TH><TH>starts-with</TH><TH>contains</TH></TR> |
<xsl:for-each select="//string"> |
<TR> |
<TD><xsl:value-of select="."/></TD> |
<TD><xsl:value-of select="starts-with(//text,.)"/></TD> |
<TD><xsl:value-of select="contains(//text,.)"/></TD> |
</TR> |
</xsl:for-each> |
</TABLE> |
</xsl:template> |
</xsl:stylesheet> |
HTML 1 | HOME XML XSL 1 OUTPUT 1 |
---|
<HTML> |
<HEAD> </HEAD> |
<BODY> |
<TABLE border="1"> |
<TR> |
<TH colspan="3">Welcome to XSL world.</TH></TR> |
<TR> |
<TH>string</TH> |
<TH>starts-with</TH> |
<TH>contains</TH></TR> |
<TR> |
<TD>Welcome</TD> |
<TD>true</TD> |
<TD>true</TD></TR> |
<TR> |
<TD>XSL</TD> |
<TD>false</TD> |
<TD>true</TD></TR> |
<TR> |
<TD>XML</TD> |
<TD>false</TD> |
<TD>false</TD></TR></TABLE> </BODY> </HTML> |
OUTPUT 1 | HOME XML XSL 1 HTML 1 |
---|
Welcome to XSL world. | ||
---|---|---|
string | starts-with | contains |
Welcome | true | true |
XSL | false | true |
XML | false | false |