list of string type variable : sequence « XSLT stylesheet « XML






list of string type variable



File: Transform.xslt


<?xml version="1.0"?>
<xsl:stylesheet version="2.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xsl:output method="text"/>
 
  <xsl:variable name="English-months" as="xs:string*"
    select="('January', 'February', 'March', 'April', 
             'May', 'June', 'July', 'August', 
             'September', 'October', 'November', 
             'December')"/>
  <xsl:variable name="German-months" as="xs:string*"
    select="('Januar', 'Februar', 'M&#xE4;rz', 'April', 
             'Mai', 'Juni', 'Juli', 'August', 
             'September', 'Oktober', 'November', 
             'Dezember')"/>

  <xsl:template match="/">
    <xsl:value-of 
      select="for $m in ($English-months, $German-months) return
                if (starts-with($m, 'J')) 
                  then concat ($m, ' starts with J!&#xA;')
                  else ''"
      separator=""/>
  </xsl:template>

</xsl:stylesheet>

Output:

January starts with J!
June starts with J!
July starts with J!
Januar starts with J!
Juni starts with J!
Juli starts with J!

 








Related examples in the same category

1.Comparing sequences with values
2.Sequence of node()