EXSLT - func:function - Use Case 1

Category: example
XML Definition: func.function.xml

This use case tests the result of a function that involves a func:result element within a xsl:for-each element.

Use Case

Source (view)

<doc>
   <section index="section1"
            index2="atr2val">
      <section index="subSection1.1">
         <p>Hello</p>
         <p>Hello again.</p>
      </section>
   </section>
   <section index="section2">
      <p>Hello2</p>
      <section index="subSection2.1">
         <p>Hello</p>
         <p>Hello again.</p>
      </section>
      <section index="subSection2.2">
         <p>Hello</p>
         <p>Hello again.</p>
      </section>
      <p>Hello2 again.</p>
      <section index="subSection2.3">
         <p>Hello</p>
         <p>Hello again.</p>
      </section>
   </section>
</doc>

Stylesheet (view)

<func:function name="my:count-elements">
   <xsl:for-each select="(//*)[1]">
      <func:result select="count(//*)" />
   </xsl:for-each>
</func:function>
<xsl:template match="/">
   <out>
      <xsl:value-of select="my:count-elements()" />
   </out>
</xsl:template>

Result (view)

<out xmlns:my="my://own.uri">17</out>

Change History

Previous Version: ..NaN.html

VersionModifiedByDetails
12001-04-28Mike Kay

Tests functionality of func:function.

http://www.exslt.org/func/elements/function/func.function.use-case.1.html last modified 2001-04-28