Community-Credit.com | NonProfitWays.com | SOAPitstop.com   Skin:   
      User: Not logged in 
Home
Newsletter Signup
XSLT Library
Latest XML Blogs
Featured Examples
Presentations
Featured Articles
Book Chapters
Training Courses
Events
NewsGroups
 
Discussions
Examples
Tutorials
Tools
Articles
Resources
Websites
 
Sign In
My Profile
My Articles
My Examples
My Favorites
My Resources
Add a Resource
Logout
 
About Me
My Blog
HeadGeek Articles
Talking Portfolio
Resume
Pictures
World Trip Pics

Recursion reminds me of Recursion (9 XSLT Recursion examples)
Author: David Silverlight
Published: 11/25/2005 4:10 PM
Category: XML, XSL
Summary: This snippet contains 9 examples of common usages of recursion: Iterating through a string of characters, Split(), TrimL(), TrimR(), Loop(), Replace(), LineFeed_To_BR, Min(), Max()

 
The following samples correspond to the "Shedding a little light on XML" Q&A column for a past XML Journal article on recursion. I coded about half of the examples and included recursion examples from other contributors.

Also Note that the download includes an example of how to use Recursion in VB to load a treeview control.

Example 1: Iterating through a string of characters.
File Description
ProcessString.xsl XML XSL Stylesheet which contains the recursive "ProcessString" template
ShowProcessString.xsl XSLT Stylesheet used to call the ProcessString template
ShowProcessStringOutput.htm Example of the HTML output that will result from transforming ShowProcessString.xml with ShowProcessString.xsl
ShowProcessString.xml The XML File containing the string of characters we are converting.
ProcessString.zip All files for the ProcessString() template example


Example 2: Split() - "Splitting XML elements into smaller XML Elements"
File Description
ShowSplitOutput.xml XML file used to demonstrate the output from the Split template sample
Employees.xml XML Employee data used to demonstrate the Split() template
Split.xsl Template used for splitting an element into smaller elements.
ShowSplit.xsl XSLT file used to demonstrate the Split() template in action.
Split.zip All files for the split() template example


Example 3: TrimL() - "Removing the leading spaces from a string"
File Description
ShowTrimLOutput.htm HTML file used to demonstrate the output from the TrimL template sample
Employees.xml XML Employee data used to demonstrate the TrimL template.
ShowTrimL.xsl XSLT file used to demonstrate the TrimL template in action
TrimL.xsl The TrimL() template used for removing the leading spaces from a string.
TrimL.zip All files for the TrimL() template example


Example 4: TrimR() - "Removing the trailingspaces from a string"
File Description
ShowTrimROutput.htm HTML file used to demonstrate the output from the TrimR template sample
Employees.xml XML Employee data used to demonstrate the TrimR template.
ShowTrimR.xsl XSLT file used to demonstrate the TrimL template in action
TrimR.xsl The TrimR() template used for removing the trailing spaces from a string.
TrimR.zip All files for the TrimR() template example


Example 5: Loop() - "Repeating a string X number of times. Contributed by Ken G. Holman-  
File Description
Loop.xsl XSLT file used to demonstrate the repeating of a string X number of times.
LoopOutput.txt Text file used to demonstrate the output from the Loop template sample
Loop.zip All files for the Loop() template example


Example 6: Replace() - Using a named template to do substring replacement, contributed Mike J. Brown of Fourthought, Inc 
File Description
Replace.xsl XSLT file used to demonstrate substring replacement
ReplaceOutput.htm HTML file showing the results of the substring replacement
Replace.zip All files for the Replace() template example.


Example 7: LineFeed_To_BR() - "Transformation of linefeed characters to HTML <br> tags, contributed byMike J. Brown of Fourthought -
File Description
LF_to_BR.xsl XSLT file used for transforming linefeed characters to <br> tags
LF_to_BROutput.htm HTML file used to demonstrate the Linefeed to BR functionality
LF_to_BR.zip All files for the LF_to_BR()template example.


Example 8: Min() - Finding the minimum element in a nodeset
File Description
ShowMinOutput.htm HTML file used to demonstrate the output from the Min template sample
Min.xsl The Min() template used for finding the minimum value in a nodeset
ShowMin.xsl Template used for demonstrating the use of the Min() template
Temperatures.xml XML Temperature data used for demonstrating the Min() template
Min.zip All files for the Min()template example.


Example 9: Max() - "Finding the Maximum element in a nodeset
File Description
ShowMaxOutput.htm HTML file used to demonstrate the output from the Max()n template sample
Max.xsl The Max() template used for finding the maximum value in a nodeset
ShowMax.xsl Template used for demonstrating the use of the Max() template
Temperatures.xml XML Temperature data used for demonstrating the Max() template
Max.zip All files for the Max()template example


 

 
Fans of "The Office"
Dwight Bobbleheads are here!
  “It's me! I'm the bobblehead! Yes!”



Advertise on XMLPitstop

Advertise on XMLPitstop


EggHead Cafe
Web Servicee development
DotNetSlackers
Buy text ads here!
remote online storage
Color Laser Printer
Marc jacobs sunglasses
Skype vs. sipcall
VoIP Internettelefonie
Buy text ads here!

Interested in Text ads?
2,223 Total Members
36 members(last 30 days)
8 members(last 7 days)
2 members(today)

1,609 Total Discussions
12 Posts(last 30 days)
0 Posts(last 7 days)
0 Posts(today)

17,260 Total Blog Posts
1,839 Blogs(last 30 days)
342 Blogs(last 7 days)
49 Blogs(today)

8,699 Newsgroup Posts
0 Posts(last 30 days)
0 Posts(last 7 days)
0 Posts(today)

13,786 Total Resources
5 Resources(last 30 days)
1 Resources(last 7 days)
0 Resources(today)


 

David Silverlight's XMLPitstop.com| 2801 Florida Ave #225|Miami, FL 33133|Ph:305-447-1139