473,668 Members | 2,586 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with recursive xsl

1 New Member
Can anyone help me with this

Using the input file, test1.xml, use a recursive xsl template to produce the output below (only the xsl file may be changed)

test1.xml contains:
<test1 highlighted="6" start="1" end="10"/>

Output:

* 1
* 2
* 3
* 4
* 5
* 6
* 7
* 8
* 9
* 10

*************** ***

test1.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="test1.xsl "?>
<test1 highlighted="6" start="1" end="10"/>


test1.xsl:

<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance">

<xsl:output method="html" indent="yes"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d"
omit-xml-declaration="ye s" encoding="iso-8859-1"/>

<xsl:template match="test1">

<body>
<html>

{output goes here}

</html>
</body>
</xsl:template>

</xsl:stylesheet>
Aug 1 '07 #1
1 1040
jkmyoung
2,057 Recognized Expert Top Contributor
<xsl:call-template name="recurse"/>

<xsl:template name="recurse">
<xsl:param name="current" select="@start"/>
<xsl:if test="$current = @highlighted"> <!-- apply special formatting? -->
</xsl:if>
* <xsl:value-of select="$curren t"/>
<xsl:if test="$current &lt; @end">
<xsl:call-template name="recurse">
<xsl:with-param name="current" select="$curren t + 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
Aug 7 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

15
1632
by: chahnaz.ourzikene | last post by:
Hi all, This is the first i post in this newsgroup, i hope my english is not too bad... Let's get straight to the point ! I have a little probleme using threads in my little training example : I wish to create two threads in my application, one thread (the subject) will increment a variable, and another thread (the controller) will print a message saying "i am waiting..." or someting like that, until the counter of the first thread...
2
2881
by: | last post by:
OK: Purpose: Using user's input and 3 recursive functions, construct an hour glass figure. Main can only have user input, loops and function calls. Recursive function 1 takes input and displays a sequence of spaces; recursive function 2 uses input to display ascending sequence of digits; likewise, recursive function 3 uses input to display descending sequence of digits. I have not followed the instructions completely regarding the...
8
1408
by: ali | last post by:
Hi, I'm trying to work on a recursive function that will give me root valuefor a given number. What i mean by root value is, if given 13, the answer is 1+3 = 4. If given 65, the answer is 2, i.e, 6+5=11, and 1+1=2. The final answer is always less than 10. I've been able to work on the code, but i can get it to work for
0
1405
by: Patrick.O.Ige | last post by:
I have this code below. All its suppose to do is to EXPAND / COLLAPSE ALL of my treeview. But when i use ASP.NET WEbmatrix it all works fine .. But with VS.NET is says TreeNodeCollection not defined and TreeNode not defined!!!!!!!!!!!!!!arg!!!! How am i suppose to define it in VS.NET.. Any help appreciated!
0
1831
by: Michael L | last post by:
Hi Guys(I apologize for the lengty post - Im trying to explain it as best i can) I've been cracking my head on this one for the past 24+ hours and i have tried creating the function in ten different ways and none of the versions i've made works exactly as it should. I have an array called $PageArray which contains a sorted list of all pages in my application. Im trying to create a recursive function(It dosn't need to be recursive if...
1
1334
by: none | last post by:
I'm trying to create a recursive function to evaluate the expressions within a list. The function uses eval() to evaluate the list. Like a lisp interpreter but very limited. What I'm looking for is a function to recursively traverse the list and provide answers in place of lists, so that ... Example = , ] Becomes: Example = Becomes: Example = 7 *Functions are defined in the script
0
1954
by: champ1979 | last post by:
I wrote an algorithm to get all the relatives of a person in a family tree. I'm basically getting all the users from the DB and am doing the recursive logic in code, so that there is only 1 call made to the DB. However, I am trying to do the same thing within a stored procedure in SQL using recursive CTEs (I think the performance might be better) but I'm finding it really tough to craft the CTE. I would really appreciate if someone could...
4
1903
by: rumbylove | last post by:
Could I please have the solutions to the following problems 1. (4 points) Your friend has to write code to make sure that the parentheses in an arithmetic expression are balanced, i.e. for every left parenthesis there is a matching right parenthesis. She wants to use a tree to do this. You argue that if all you want to do is match parentheses, then a stack will work fine. How will you use a stack to do this? 2. (6 points) A palindrome is...
0
8462
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8381
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8583
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7401
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6209
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5681
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4205
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4380
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2791
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.