substring function : substring « XSLT stylesheet « XML






substring function

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="." />
    <xsl:value-of select="substring(.,7,6)" />
    <xsl:value-of select="substring(.,12)" />
  </xsl:template>

  
</xsl:stylesheet>
Output:


  line 1
  

    line 2

  ne 2


  

 








Related examples in the same category

1.substring with index