File: Data.xml
<poem>
<verse>line 1</verse>
<verse>
line 2
</verse>
</poem>
File: Transform.xslt
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes" indent="no" />
<xsl:template match="verse">
<xsl:value-of select="concat('length: ',string-length(.))" />
<xsl:if test="contains(.,'light')">
<xsl:text>light: yes!</xsl:text>
</xsl:if>
<xsl:if test="starts-with(.,'Seest')">
<xsl:text>Yes, starts with "Seest"</xsl:text>
</xsl:if>
<xsl:value-of select="normalize-space(.)" />
<xsl:value-of select="translate(.,'abcde','ABCD')" />
</xsl:template>
</xsl:stylesheet>
Output:
length: 6line 1lin 1
length: 13line 2
lin 2
|