473,508 Members | 2,477 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSLT : For-each

Hi,

Not sure if this is the right forum, but does anybody have any experience of
using a XSLT variable in a xsl:for-each loop.

As in, I want to pass in a variable called source which itself holds the
root of the data I wish to loop through.

<xsl:for-each select = "$source">
' Do something
</xsl:for-each>
Feb 14 '06 #1
4 1031
Try seeing this tutorial
http://www.w3schools.com/xsl/xsl_for_each.asp
Hope that helps
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Feb 14 '06 #2
You use a template. Example:

<xsl:template select="XPathToElements">
<!-- whatever you want to do -->
</xsl:template>

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
We got a sick zebra a hat,
you ultimate tuna.
"Redowl" <Re****@discussions.microsoft.com> wrote in message
news:BD**********************************@microsof t.com...
Hi,

Not sure if this is the right forum, but does anybody have any experience
of
using a XSLT variable in a xsl:for-each loop.

As in, I want to pass in a variable called source which itself holds the
root of the data I wish to loop through.

<xsl:for-each select = "$source">
' Do something
</xsl:for-each>

Feb 14 '06 #3
Not really the right group, but..

<xsl:variable name="xpath" select="//link" />

<xsl:for-each select="$xpath">

</xsl:for-each>
should work

now, if you want the variable to be driven from ASP.NET, ur in a totally
different league. You pretty much need to rename your xsl to aspx, make your
xml file point to the aspx file, change the content type of yoru aspx file
to whatever xsl needs to be and then you can simply use something like

select="<%=myXPath%>"
Karl

--
http://www.openmymind.net/

"Redowl" <Re****@discussions.microsoft.com> wrote in message
news:BD**********************************@microsof t.com...
Hi,

Not sure if this is the right forum, but does anybody have any experience
of
using a XSLT variable in a xsl:for-each loop.

As in, I want to pass in a variable called source which itself holds the
root of the data I wish to loop through.

<xsl:for-each select = "$source">
' Do something
</xsl:for-each>

Feb 14 '06 #4
Redowl wrote:
Hi,

Not sure if this is the right forum, but does anybody have any experience of
using a XSLT variable in a xsl:for-each loop.

As in, I want to pass in a variable called source which itself holds the
root of the data I wish to loop through.

<xsl:for-each select = "$source">
' Do something
</xsl:for-each>


There is a microsoft.public.xsl group which has tons of QA. You could
become an XSL expert just following along in that group. This for-each
question is answered many times over in that group. Very high
signal/noise there.

--
Jay R. Wren
Feb 14 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3577
by: Mohit | last post by:
Hi Friends I have to call 1 of the 2 child XSLT files from the Main XSLT file based on some criteria. I want one child XSLT file will be executed by version 1 of XSLT processor and the other by...
0
1444
by: Mike | last post by:
I'm generating an XSLT document programatically in VB.Net. I'm then trying to apply that XSLT against a cXML document to generate my own internally developed XML document. I'm using RichTextBox...
5
4393
by: shauldar | last post by:
Is there a way (tool, hack...) to create an XSL:FO from an XSLT + XML files? My motivation is that we want to use a tool to design reports, and from that "design" generate both HTML (via XSLT)...
4
2141
by: Moogy | last post by:
I'm pulling my hair out here. First, I'm new to XML, so that doesn't help, but none of this makes any sense to me. All I'm trying to do is take a simple source XML file and translate it with an...
0
2336
by: Christopher M. Lauer | last post by:
I have done my best to answer this question but can not find the proper set of commands. I would like to transform an xml file (in code behind) and display its output in a specific html tag,...
1
1597
by: Dan | last post by:
I have a C# program which executes some XSLT transformations. The XSLT code requires an input intermediate file, generated by other transformations, as its duty is copying some data from an input...
3
1665
by: RC | last post by:
Let's say: if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { // Now I got an XML object here var xmlDocument = XMLHttpRequestObject.responseXML; // next I have...
7
7856
by: Zzzbla | last post by:
Hi all, anyone has a live example of loading an xml file from a server, an xslt file from the server, then transforming the xml using the xslt and outputing the results (preferably with...
12
11551
by: Chris | last post by:
Hi, Just wondering if anyone out there knows if it is possible to convert a CSV to xml using XSLT? I've seen a lot of examples of xml to CSV, but is it possible to go back the other way? I...
0
1219
by: ManWithNoName | last post by:
The following question is related to this thread: XSLT, document() function, filename, read non-standard/English characters (like µ) I have a XML file with a non-English character in its name...
0
7133
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...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7066
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...
0
5643
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,...
0
4724
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...
0
3214
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...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
435
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.