|
|
|
| |
Menu |
|
|
| |
|
|
| |
|
|
|
|
 |
|
|
|
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.
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 |
|
|
|
|
|
Downloads |
|
|
|
|
|
|
|
|
|
|
|
|
Featured
Products |
Advertise on
XMLPitstop
|
Our
Sponsors |
Advertise on
XMLPitstop
|
Partners |
|
Friends |
|
Statistics |
4,027 Total Members
15 members(last 30 days)
7 members(last 7 days)
0 members(today)
1,948 Total Discussions
0 Posts(last 30 days)
0 Posts(last 7 days)
0 Posts(today)
47,487 Total Blog Posts
0 Blogs(last 30 days)
0 Blogs(last 7 days)
0 Blogs(today)
8,699 Newsgroup Posts
0 Posts(last 30 days)
0 Posts(last 7 days)
0 Posts(today)
14,120 Total Resources
8 Resources(last 30 days)
1 Resources(last 7 days)
0 Resources(today)
|
|
|
| |
|