Previous | Next | Indexes
Zvon > Tutorials > XSLT 2.0 Tutorial > Value-of (6/6) >

Separators from source document

Characters used in separator attribute can be extracted from the source XML document.

XSLT

      <xsl:stylesheet
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  version="2.0">
            <xsl:output  method="xml"
                        indent="yes"
                        omit-xml-declaration="yes"/>

            <xsl:template  match="/aaa">
                  <xxx>
                        <xsl:value-of  select="1 to 6"
                                    separator="{@s}"/>
                  </xxx>
                  <yyy>
                        <xsl:value-of  select="1 to 6"
                                    separator="{@p}{@r}{@p}"/>
                  </yyy>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa  p="*"
                  r="|"
                  s="//"/>
Output

      <xxx>1//2//3//4//5//6</xxx>
      <yyy>1*|*2*|*3*|*4*|*5*|*6</yyy>


Previous chapter: Sequence Combinations
Next chapter: Modes
Previous page: Separators
Next page: - - -