home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="utf-8"?>
- <!-- ===========================================================
- Category: Recursion
- Author: David Silverlight
- HeadGeek@xmlpitstop.com
- Created: 2001-05-16
- Description:-
- This stylsheet demonstrates recursion by seperating the
- contents of a single element named 'computerlanguages' into
- a number of child elemements named 'computerlanguage'.
- ================================================================ -->
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:output method="xml" indent="yes"/>
- <xsl:include href="Split.xsl"/>
- <!-- Template for root rule -->
- <xsl:template match="/">
- <employees>
- <xsl:apply-templates/>
- </employees>
- </xsl:template>
- <xsl:template match="employees">
- <xsl:for-each select="employee">
- <employee>
- <xsl:copy-of select="employeename"/>
- <xsl:copy-of select="department"/>
- <!-- Call the template that will trim off right spaces (recursively, of course ) -->
- <computerlanguages>
- <xsl:call-template name="Split">
- <xsl:with-param name="strInput" select="computerlanguages"/>
- <xsl:with-param name="strDelimiter" select="','"/>
- </xsl:call-template>
- </computerlanguages>
- </employee>
- </xsl:for-each>
- </xsl:template>
- </xsl:stylesheet>