BizTalk Utilities CV ,   Jobs ,   Code library
 
Home Page


Add/Edit your code items
Search the code library
Browse for the code library


XSLT
XSLT Sort - output entire xml file with new sort order
Variable Variables
Cross Reference Lookup in XSLT using embedded XML
XTrans 1.0
XML Explorer 2.5
Create an N-Column Table from XML node-set
XSLT Select Option Example
XSLT Date filtering, sorting, comparing, and evaluating
XSLT Template for HTML INPUT Tag
XSLT Template for HTML IMG Tag
XSLT Search and Replace Template
Word wrap and text replace templates for XSLT
nxslt 1.3
Visual XPath
xframe - xsddoc
-xsl-fo-->-pdf--making-an-e-book/documentation.aspx>BIBLE PDF from (xml & xsl)-> xsl-fo -> pdf ; Making an E-book/documentation
Sum(round(.))
DISTINCT list of attributes using XPATH only
How to add a XSL information to the XML file with the XmlTextWriter?
How to update an XML file with XmlDocument?


 
 

<< XQuery.NET and XML >>


By David Silverlight
First Posted 05/24/2003
Times viewed 901

Recursion reminds me of Recursion (9 XSLT Recursion examples)


This post contains attachments
v20030524164905.zip 

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



Rate this article on a scale of 1 to 10 (0 votes, average 0)

Your vote :  

<< XQuery.NET and XML >>





Leave a comment for this article
Your name
Your email (optional)
Your comment
Optional: Upload an attachment
Enter the code shown:

 
 

    Email TopXML